bug-coreutils
[Top][All Lists]
Advanced

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

bug#9995: problem about sort -u -k


From: Eric Blake
Subject: bug#9995: problem about sort -u -k
Date: Wed, 09 Nov 2011 07:58:42 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110928 Fedora/3.1.15-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.4 Thunderbird/3.1.15

[Let's keep the list in the loop]

On 11/08/2011 07:58 PM, 夏凯 wrote:
thanks for you reply.
if i want to get my result, whether should i use sort -u -k3 -k1 -k2 a
to do that?


I'm still not quite sure what result you want.

sort -u -k3 -k1 -k2 a

says to sort with three keys - from field 3 to the end of the line, from field 1 to the end of the line (aka the entire line), and from field 2 to the end of the line (that -k2 is useless, since sorting by field 1 to the end of the line already sorted everything so that there is no longer any distinguishing factors from field 2 to the end of the line). Then, after sorting, sort discards any lines where all three keys are identical, and since the -k1 key was the entire line, you are discarding only duplicate lines. But I don't know if that is what you wanted.

--
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org





reply via email to

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