> This seems wrong. > > $ echo 1/3,1/2,1/1,2/1 | tr , \\012 | sort -nu -t / -k 1,2 > 1/3 > 2/1 > $ > > -u should only filter out lines that compare equal on *all* key fields. > I've opened an Ubuntu bug at > https://launchpad.net/distros/ubuntu/+source/coreutils/+bug/56891 which > has more detail and examples. I was hoping someone here could either > confirm it's a bug or point out my misunderstanding.
According to POSIX, -n will "Restrict the sort key to an initial numeric string", and -t "can be included in a sort key". You specified only one sort key, namely the string that extends from field 1 (the first digit) through field 2 (the second digit), including the delimiter /, which is non-numeric, so sort is properly sorting numerically on the initial numeric string of your specified key (and hence, you only get two outputs). Try instead specifying a primary and secondary key: $ echo 1/3,1/2,1/1,2/1 | tr , \\012 | sort -u -t / -k1n,1 -k2n,2 1/1 1/2 1/3 2/1 $ -- Eric Blake _______________________________________________ Bug-coreutils mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-coreutils
