coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Feature suggestion: sort --skip-header-lines=N (and perhaps --skip-t


From: Pádraig Brady
Subject: Re: Feature suggestion: sort --skip-header-lines=N (and perhaps --skip-trailer-lines?)
Date: Mon, 26 Oct 2015 11:40:54 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

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

[Prev in Thread] Current Thread [Next in Thread]