coreutils
[Top][All Lists]
Advanced

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

Re: sort : skipping "header" row(s) - possibile new command line option?


From: Bernhard Voelker
Subject: Re: sort : skipping "header" row(s) - possibile new command line option?
Date: Thu, 20 Nov 2014 11:32:04 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

On 11/20/2014 07:24 AM, Bradley Dean wrote:
Thanks! Piping through ( sed -u 1q && sort ... ) works for me and is
less typing than my example workaround.

BTW: Please note that older sed versions might slurp more input than
needed - even with the -u option - e.g. on SLES11 the subsequent sort
won't see any input (sed 4.1.5):

  $ df | { sed -u 1q && sort -k5,5n; }
  Filesystem                 1K-blocks      Used Available Use% Mounted on

BTW2: Although "sed -u 1q" should be the ~same as "head -n1", the latter
also consumes the whole df(1) output (even the latest git version):

  $ src/df | { src/head -n1 && src/sort -k5,5n; }
  Filesystem                          1K-blocks      Used Available Use% 
Mounted on

It's not clear for me from the specification [0] wether head(1) is
allowed to consume more than specified by the -n option.
Padraig?

[0]
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/head.html

Have a nice day,
Berny




reply via email to

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