Hello, It appears that sort does not examine the proper fields specified by '-k' unless the '-n' option is given.
(Behavior observed on 4.5.3 utils included withRedHat EL3. Behavior is consistent with compiled 5.0 binaries from gnu.org) localhost$sort --version sort (coreutils) 4.5.3 Written by Mike Haertel and Paul Eggert. .... localhost$ cat sort_challenge6 0 1 0 2 1 0 0 1 2 9 0 0 0 3 5 0 1 1 3 4 1 0 0 1 3 1 1 1 2 6 1 1 1 1 2 1 1 0 4 7 1 0 1 4 8 localhost$ sort -s -k 3 sort_challenge6 1 0 0 1 3 0 1 0 2 1 0 0 0 3 5 1 1 0 4 7 1 1 1 1 2 1 1 1 2 6 0 0 1 2 9 0 1 1 3 4 1 0 1 4 8 >>>>>>>>>This sort appears to sort by all fields following field 3 localhost$ sort -s -n -k 3 sort_challenge6 0 1 0 2 1 0 0 0 3 5 1 0 0 1 3 1 1 0 4 7 0 0 1 2 9 0 1 1 3 4 1 1 1 2 6 1 1 1 1 2 1 0 1 4 8 >>>>>>>>>Adding '-n' fixes the trouble localhost$ sort -s -k 3 -k 5 sort_challenge6 1 0 0 1 3 0 1 0 2 1 0 0 0 3 5 1 1 0 4 7 1 1 1 1 2 1 1 1 2 6 0 0 1 2 9 0 1 1 3 4 1 0 1 4 8 >>>>>>>>>The second key argument is ignored and results are identical to 'sort -s -k 3 sort_challenge6' above localhost$ sort -n -s -k 3 -k 5 sort_challenge6 0 1 0 2 1 1 0 0 1 3 0 0 0 3 5 1 1 0 4 7 1 1 1 1 2 0 1 1 3 4 1 1 1 2 6 1 0 1 4 8 0 0 1 2 9 >>>>>>>>>Adding the '-n' corrects this as well. Mark Frost -- "When trouble arises and things look bad, there is always one individual who perceives a solution and is willing to take command. Very Often, that individual is crazy." --Dave Barry _______________________________________________ Bug-coreutils mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-coreutils
