coreutils
[Top][All Lists]
Advanced

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

Re: sort by hex number?


From: Pádraig Brady
Subject: Re: sort by hex number?
Date: Fri, 6 Mar 2020 11:08:24 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:73.0) Gecko/20100101 Thunderbird/73.0

On 05/03/2020 15:14, Peng Yu wrote:
I have a TSV file with a column in hex format, e.g., 0x1a000, 0x17000, 0xe000.

Is there a way to sort the rows by this column in hex? Thanks.

-g supports hex, though has overhead in float conversion.
For example `sort -k2,2g` would sort on the second key if hex.
Note if the numbers are fixed width, or can be prepended with 0 to a fixed 
width,
then you can use simple textual comparison to do the sort.

cheers,
Pádraig




reply via email to

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