On 01/17/2014 10:37 AM, Bartosz Gołaszewski wrote: > Hi, > > for the following input: > 42 1 3 woot > 42 1 010 zoology > egg 1 2 papyrus > 7 3 42 soup > 999 3 0 algebra > > this is what debug-enabled sort in coreutils 8.22 outputs: > > % sort --debug ./input -k2,3n > sort: using simple byte comparison > sort: key 1 is numeric and spans multiple fields
So these are warning messages indicating a usage issue. The specific one here is you've _spanned_ multiple fields but numeric compares auto terminate at the first numbers. > 42 1 010 zoology > _ > _______________________________ > 42 1 3 woot > _ > ____________________________ > egg 1 2 papyrus > _ > _______________________________ > 7 3 42 soup > _ > ____________________________ > 999 3 0 algebra > _ > _______________________________ > > It seems as if only the second field was used in comparison, even > though sort knows that the key 'spans multiple fields'. Is this a > correct behaviour? If so - could anyone explain why? You probably want to compare multiple fields in sequence. I.E. sort -k2,2n -k3,3n thanks, Pádraig.