GNU bug report logs -
#6393
The meaning of --key of sort command?
Previous Next
Reported by: Peng Yu <pengyu.ut <at> gmail.com>
Date: Thu, 10 Jun 2010 16:40:02 UTC
Severity: normal
Tags: notabug
Done: Pádraig Brady <P <at> draigBrady.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
On 06/10/2010 10:39 AM, Peng Yu wrote:
> Hi,
>
> I don't think that I completely understand what key means. In the
> following example, I thought that --key=2 should order the lines by
> the 2nd letter in each line without reordering the lines with the same
> 2nd letter. But it turns out my understanding is not correct. For
> example, "u a" was before "a a" sorting, but "u a" is after "a a"
> after sorting.
'--key=2' implies a primary sort key from the second field (not second
letter), through the end of the line, with a secondary sort key of the
entire line. '--key=2,2' implies a primary sort key of just the second
field, with a secondary sort key of the entire line. You want
'--key=2,2 --stable', which disables the secondary sort over the entire
line.
--
Eric Blake eblake <at> redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
[signature.asc (application/pgp-signature, attachment)]
This bug report was last modified 14 years and 312 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.