I'm experimenting with GNU sort and LC_COLLATE="en_US.UTF-8". I have a file called 'test':
1,0 1
10 2
1,0 3
10 4
With sort -k1,2
as well as with simple sort test
the order doesn't change:
$ sort -k1,2 test
1,0 1
10 2
1,0 3
10 4
So, sort thinks that '1,0' is equal to '10' probably due to some quirks of LC_COLLATE (skipping punctuation?)
Now, when I use sort -k1,1 -k2,2
, it gives me a different order:
$ sort -k1,1 -k2,2 test
10 2
10 4
1,0 1
1,0 3
and suddenly sort doesn't think that '10' is the same as '1,0' anymore.
What happened? Why isn't sort -k1,1 -k2,2
equivalent to sort -k1,2
in this case? Should it really be equivalent? Or have I misinterpreted the man page? (I tried versions 8.22 and 8.29 of coreutils, both have this behavior)