[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#13638: linux-sort inconsistency
From: |
Paul Eggert |
Subject: |
bug#13638: linux-sort inconsistency |
Date: |
Wed, 06 Feb 2013 10:05:58 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 |
On 02/06/13 02:49, Knud Arnbjerg Christensen wrote:
> linux-sort inconsistency occours when sorting an alfpha-numeric field,
> then the order becomes different depending on if the following field is
> numeric (file 1) or alfanumeric (file 2). In case one the length of the
> shorter fields is extended by ´zeros´ in case 2 the fields is extended by
> blanks which cause the different sorting order.
>
> knud c
>
> sort -k 1 file1>file1-sorted
It looks to me like 'sort' is behaving as documented.
'-k 1' means "use the concatenation of all the fields, starting
with field 1, as the key". It does not mean "use
just field 1 as the key". The documentation explains
this in some detail.