--- Begin Message ---
Subject: |
sort -c not using proper keyspec |
Date: |
Fri, 28 May 2010 14:04:44 -0600 |
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)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Mike Haertel and Paul Eggert.
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#6296: sort -c not using proper keyspec |
Date: |
Sun, 30 May 2010 00:32:52 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 |
tags 6296 + notabug
On 28/05/10 21:04, address@hidden 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.
--- End Message ---