[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: |
Juncheng Yang |
Subject: |
bug#51011: [GNU sort] Numerical sort with delimiter may be broken (bug) |
Date: |
Mon, 4 Oct 2021 18:51:50 -0400 |
Thank you, Paul and Padraig!
May I ask when it fails to sort numerically why 1,a comes before 0,9? I could
not come up with an ordering that 1,a is smaller.
Best,
Jason
> On Oct 4, 2021, at 4:01 PM, Paul Eggert <eggert@cs.ucla.edu> wrote:
>
> 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
> ___
> ___
- bug#51011: [GNU sort] Numerical sort with delimiter may be broken (bug), Juncheng Yang, 2021/10/04
- bug#51011: [GNU sort] Numerical sort with delimiter may be broken (bug), Davide Brini, 2021/10/04
- bug#51011: [GNU sort] Numerical sort with delimiter may be broken (bug), Pádraig Brady, 2021/10/04
- bug#51011: [GNU sort] Numerical sort with delimiter may be broken (bug), Paul Eggert, 2021/10/04
- bug#51011: [GNU sort] Numerical sort with delimiter may be broken (bug),
Juncheng Yang <=
- bug#51011: [GNU sort] Numerical sort with delimiter may be broken (bug), Pádraig Brady, 2021/10/08
- bug#51011: [GNU sort] Numerical sort with delimiter may be broken (bug), Paul Eggert, 2021/10/08
- bug#51011: [GNU sort] Numerical sort with delimiter may be broken (bug), Pádraig Brady, 2021/10/08
- bug#51011: [GNU sort] Numerical sort with delimiter may be broken (bug), Paul Eggert, 2021/10/08
- bug#51011: [GNU sort] Numerical sort with delimiter may be broken (bug), Pádraig Brady, 2021/10/09
- bug#51011: [GNU sort] Numerical sort with delimiter may be broken (bug), Paul Eggert, 2021/10/09
- bug#51011: [PATCH] sort: --debug: add warnings about radix and grouping chars, Pádraig Brady, 2021/10/10
- bug#51011: [PATCH] sort: --debug: add warnings about radix and grouping chars, Bernhard Voelker, 2021/10/10
- bug#51011: [PATCH] sort: --debug: add warnings about radix and grouping chars, Paul Eggert, 2021/10/10
- bug#51011: [PATCH] sort: --debug: add warnings about radix and grouping chars, Pádraig Brady, 2021/10/10