bug-coreutils
[Top][All Lists]
Advanced

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

bug#22109: Sort gives incorrect order when changing delimiters


From: Ed Brambley
Subject: bug#22109: Sort gives incorrect order when changing delimiters
Date: Mon, 7 Dec 2015 15:36:12 +0000

The following problem came to light following a StackOverflow question [1]. The lexical ordering of sort appears to depend on the delimiter used, and I believe it shouldn't. As a minimal example:

### Correct ordering ###
$ printf "1,a,1\n2,aa,2" | LC_ALL=C sort -k2 -t,
1,a,1
2,aa,2

### Incorrect ordering by replacing the "," delimiter by "~" ###
$ printf "1~a~1\n2~aa~2" | LC_ALL=C sort -k2 -t~
2~aa~2
1~a~1

I think this is because, in ASCII, "," < "a" < "~".

Many thanks,
Ed

[1] http://stackoverflow.com/questions/34134677/trying-to-understand-the-sort-utilty-in-linux

reply via email to

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