Thank you Assaf for the clarification.
Alain
On 01/06/2016 17:44, Assaf Gordon wrote:
tag 23673 notabug
close 23673
stop
Hello Alain,
On 06/01/2016 09:16 AM, alainm wrote:
I need to perform a sort based on the first 3 indexes of a line (sort
-k 1,3 -n truc.lst):
The 0 coordinates are not placed before the 2 coordinates, it looks
like the spaces are ignore:
[...]
[alainm@tagir 1src]$ sort -k 1,3 -n truc.lst
To sort multiple numeric fields, use separate "-k" parameters, like so:
sort -k1,1 -k2,2 -k3,3 -n truc.list
If in the future you wish to combine different ordering (e.g. numeric
and alphanumeric, or some fields in reverse order),
consider specifying the order in each key instead of globally:
sort -k1n,1 -k2nr,2 -k3n,3 truc.list
[alainm@tagir 1src]$ sort --version
sort (GNU coreutils) 8.4
If you upgrade to coreutils version 8.6 or later, sort will accept
'--debug' option, which will help you troubleshoot such cases:
$ sort --debug -k 1,3 -n truc.lst
sort: using ‘en_US.UTF-8’ sorting rules
sort: key 1 is numeric and spans multiple fields
[...]
I'm marking this bug as done, but discussion can continue by replying
to this thread.
regards,
- assaf