tags 6296 + notabug On 28/05/10 21:04, [email protected] wrote: > CoreUtils, > > I believe sort(1) is not honoring the keyspec I provide in the case of a '-c' > run. Here's a small file and the behavior I'm seeing. > > I realize sort keyspecs can be tricky -- I hope this is not a case of user > error! > > Thanks, > Jim > > $ head -5 x.scan.txt > 1 5242857 + 25 1 > 1 15728631 + 25 1 > 1 17825783 + 25 1 > 1 36700126 + 50 1 > 1 36700126 + 47 1 > > $ awk '{print $1,$2}' x.scan.txt|sort -c -k1,1n -k2,2n > > $ sort -c -k1,1n -k2,2n x.scan.txt > sort: x.scan.txt:5: disorder: 1 36700126 + 47 1 > > $ sort --version > sort (GNU coreutils) 8.5 > Packaged by Cygwin (8.5-1)
The next released version of coreutils will have the sort --debug option which illustrates what's happening: $ sort --debug -c -k1,1n -k2,2n x.scan.txt sort: using `en_IE.UTF-8' sorting rules sort: x.scan.txt:5: disorder: 1 36700126 + 47 1 _ ________ _________________ So the last resort comparison is causing the issue, and you can disable that by also specifying the -s option. cheers, Pádraig.
