coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

sort by hex numeric value


From: Ciro Santilli
Subject: sort by hex numeric value
Date: Sat, 19 Aug 2017 10:57:22 +0100

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

[Prev in Thread] Current Thread [Next in Thread]