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: Annihilannic .
Subject: RE: Feature suggestion: sort --skip-header-lines=N (and perhaps --skip-trailer-lines?)
Date: Tue, 27 Oct 2015 16:09:03 +1100



> From: address@hidden
> On 26/10/15 04:31, Annihilannic wrote:
> > 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
> 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 )

Unfortunately (as mentioned in that discussion) it has taken so long for the stdio buffer handling to make it into sed that it isn't available on any of the systems I use regularly (RHEL5, RHEL6, SLES11, ...) although I eventually found it on an Ubuntu 15.04 system.

Please consider this a +1 vote for the feature.  Perhaps it isn't so marginal if I'm revisiting a previously revisited suggestion?  :-)

Meanwhile here is a more backward-compatible workaround:

( echo 99 ; seq 10 ) | awk -v hdr=1 'NR<=hdr{print;next}{print | "sort -n"}'

(Actually, I just noticed from the archives that Stephane Chazelas came up with an almost identical suggestion...)

Thanks and regards,

Scott

reply via email to

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