Is it possible to sort by hex values, with or without the 0x prefix? If
not, feature request!

8.25 behavior:

$ printf '0a\n1\n' | sort -n
0a
1
$ printf '0x0a\n0x1\n' | sort -n

0x0a
0x1
$ printf '09\n1\n' | sort -n
1
09

Not sure what is the best approach about backwards compatibility. Maybe
allow a base number after -n e.g.:

sort -n16

or add a new option:

sort -H

https://unix.stackexchange.com/questions/139801/sort-by-hex-value

Reply via email to