bug-coreutils
[Top][All Lists]
Advanced

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

bug#51011: [GNU sort] Numerical sort with delimiter may be broken (bug)


From: Paul Eggert
Subject: bug#51011: [GNU sort] Numerical sort with delimiter may be broken (bug)
Date: Mon, 4 Oct 2021 13:01:56 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0

On 10/4/21 08:58, Pádraig Brady wrote:
The --debug option points out the issue:

   $ printf '%s\n' 1,a 0,9 | sort --debug -nk1 -t ,
   sort: key 1 is numeric and spans multiple fields
   1,a
   _
   ___
   0,9
   ___
   ___

As Juncheng points out, it is a bit odd that -n and -g disagree here, even in locales where ',' is not a decimal point. For example:

$ printf '1,a\n0,9\n' | sort -gk1 -t, --debug
sort: text ordering performed using ‘en_US.UTF-8’ sorting rules
sort: key 1 is numeric and spans multiple fields
0,9
_
___
1,a
_
___
$ printf '1,a\n0,9\n' | sort -nk1 -t, --debug
sort: text ordering performed using ‘en_US.UTF-8’ sorting rules
sort: key 1 is numeric and spans multiple fields
1,a
_
___
0,9
___
___





reply via email to

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