coreutils
[Top][All Lists]
Advanced

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

Re: Sort with header/skip-lines support


From: Assaf Gordon
Subject: Re: Sort with header/skip-lines support
Date: Fri, 11 Jan 2013 14:19:10 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.4) Gecko/20120510 Icedove/10.0.4

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.


> For completeness, showing the current options for such cases...

Thanks for taking the time to write these - very helpful.

-gordon




reply via email to

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