bug-coreutils
[Top][All Lists]
Advanced

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

Re: SORT bug: multiple field sort gives unexpected sort order


From: Pádraig Brady
Subject: Re: SORT bug: multiple field sort gives unexpected sort order
Date: Wed, 17 Mar 2010 11:46:58 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3

On 16/03/10 11:50, Pádraig Brady wrote:
> On 15/03/10 15:56, Denzen, van Carl wrote:
>> On ubuntu v9.03 with sort version  6.10, when I do a quite simple sort, I 
>> get unexpected result.
>> Fields are variable length, separator is a comma. I want to sort on two 
>> (Dutch style, dd-mm-yyyy) date fields. Here is the output:
>> address@hidden carl]$ cat test-input.txt
>> 23-01-1999,25-04-2008
>> ,24-04-2008
>> 23-01-1993,23-04-2008
>> ,01-02-1999
>> ,12-03-1998
>> 23-01-1991,21-04-2008
>> address@hidden carl]$ sort <test-input.txt --field-separator=, 
>> --key=1.7,1.10 --key=1.4,1.5 --key=1.1,1.2 --key=2.7,2.10 --key=2.4,2.5 
>> --key=2.1,2.2
> 
> Here is the output from running with the soon to be released --debug option.
> That shows that the first field is considered to be the delimiter+second field
> in the case where the first field is empty.  That is at least confusing and
> may be a bug.  I'll look at it this evening sometime.

I just tried it on solaris and it behaves the same as coreutils.
So it might be some corner case of the POSIX spec (which I couldn't see on a 
very quick can)

solaris:~$ LANG=C sort <test-input.txt -t, -k1.7,1.10 -k1.4,1.5 -k1.1,1.2 
-k2.7,2.10 -k2.4,2.5 -k2.1,2.2
,01-02-1999
,12-03-1998
,24-04-2008
23-01-1991,21-04-2008
23-01-1993,23-04-2008
23-01-1999,25-04-2008

~/git/coreutils$ LANG=C ./src/sort --debug <test-input.txt -t, -k1.7,1.10 
-k1.4,1.5 -k1.1,1.2 -k2.7,2.10 -k2.4,2.5 -k2.1,2.2
,01-02-1999
      ____
   __
__
       ____
    __
 __
___________
,12-03-1998
      ____
   __
__
       ____
    __
 __
___________
,24-04-2008
      ____
   __
__
       ____
    __
 __
___________

I'm being called out to St. Patrick's day celebrations,
so I'll try to look at it further this evening.

cheers,
Pádraig.




reply via email to

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