Thank you, Paul! :) In my test, the -k option of the sort on Mac behaves differently from GNU sort (I made a mistake stating -n). In other words, printf '%s\n' 1,a 0,9 | sort -nk1 -t , works on Mac, and this is why I thought GNU sort has a bug at first. Thank you again for your quick response! The GNU tools (and maintainers/contributors) are really amazing!
Best, Juncheng > On Oct 4, 2021, at 4:01 PM, Paul Eggert <egg...@cs.ucla.edu> wrote: > > On 10/4/21 08:29, Juncheng Yang wrote: >> However, this is confusing because 1) the behavior of `-n` and `-g` are not >> consistent > > Yes, that is confusing. I have followed up to Pádraig about this. > > , 2) the `-n` in GNU sort is different from the sort on MacOS (which has pos2 > as pos1+1 instead of 0)… > > GNU sort does that too; that's old-fashioned syntax that is not recommended > nowadays; it's better to use the -k option. macOS 'sort' supports supports -k > too, surely.