GNU bug report logs -
#14988
sort enhancement request
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
On 07/30/2013 04:33 PM, Eric Blake wrote:
> It SOUNDS like you are merely asking for a stable sort option. Have you
> tried the -s/--stable option? That effectively adds an invisible key of
> last resort that says if two lines otherwise compare equal, sort them so
> that the line occurring first in input also occurs first in output.
An alternative view of how -s works (that more closely matches what you
will see in 'sort --debug' output) is that POSIX requires that 'sort'
behave as if a key of -k1 were always the last key present (if two lines
otherwise compare equal, sort them by a strcoll() comparison of the
entire line), where -s is the GNU extension that disables this POSIX
implicit full-line sort key, so that you are left with a stable sort.
Since 'adding an option to remove a key' sounds a little fishy on the
surface, you can see why I gave my first explanation instead. But at
the end of the day, all that matters is the result, so pick whichever
mental representation you find easier to understand :)
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[signature.asc (application/pgp-signature, attachment)]
This bug report was last modified 12 years and 16 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.