On 26/10/15 04:31, Annihilannic wrote:
> Hi,
> 
> I find that I frequently need to sort the tabular output of a command 
> that includes heading lines, so often that I've written my own wrapper 
> 'sorthead <n> <sort options>'.  In other words, preserve the position of 
> the specified number of lines of input data.
> 
> I think this would be a generally useful feature to add to the sort 
> command, with a syntax similar to --skip-header-lines=N.  Has it been 
> considered and discarded before?  A cursory search of this mailing list 
> did not turn up any prior discussions.
> 
> Handling trailing lines in a similar way could also be useful.

This is a marginal one already discussed at:
http://lists.gnu.org/archive/html/coreutils/2013-01/msg00027.html

Summary is you can do this with GNU sed:

( echo 99 ; seq 10 ) | ( sed -u 1q ; sort -n )

thanks,
Pádraig

Reply via email to