Re: Sort with header/skip-lines support (original) (raw)

Hello Pádraig,

Your suggestions work for all the cases I needed, so essentially there's already a way to do sort+header - much appreciated!

Pádraig Brady wrote, On 01/11/2013 01:13 PM:

On 01/11/2013 04:10 PM, Assaf Gordon wrote:

Pádraig Brady wrote, On 01/10/2013 07:11 PM:

The following indeed works with sed 4.2.2 ( on linux 3.2 ): $ ( echo 99 ; seq 10 ) | ( sed -u 1q ; sort -n )

[2] - no pipe support: http://lists.gnu.org/archive/html/bug-coreutils/2007-07/msg00215.html But I'm wondering (as per the link above [2]) if this is posix compliant and stable (i.e. can this be trusted to work everytime, even on non-linux machines?).

No sed -u with this functionality is not portable. Though it's more portable than sort --header given that it already exists :)

Sorry for nitpicking, but just to verify: "sed -u" is a GNU extension, hence not portable by definition. But what I meant to ask: If I install GNU sed + GNU sort on any machine (e.g. MAC OSX), would it work in a reliable way? Eric Blake's email seemed to suggest this will never be guaranteed to work (even if it works in practice) due to sharing pipes between processes.