bug-coreutils
[Top][All Lists]
Advanced

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

Re: Re: Human readable sort


From: knome . net
Subject: Re: Re: Human readable sort
Date: Thu, 21 May 2009 21:56:18 +0000

On May 21, 2009 5:07pm, Giuseppe Scrivano <address@hidden> wrote:

I think this is a too strong assumption. I wouldn't be surprised to

find, for example, both 1M and 1500K in a data set.


I initiated this to patch sort primarily to support the data generated by df, du and ls. The human readable options these offer are often frustrating once a user realizes there is not a complimentary sort option to them. These, of course, do produce properly reduced data.


Does anyone know of a tool which produces mixed data of this sort that would need normalized unit comparison?


Are there problems to normalize values using this pseudo-code?

while (abs (a) > 1000) //or 1024

{

order_a += signum (a);

a /= 1000; //or 1024

}


Yes. The current implementation does not convert to a numeric representation but compares the numbers character by character instead.

The patch rides on top of this functionality, just adding a check to scan ahead for units and assuming that difference of unit is sufficient for determining sort order.

Anything more complex will probably have to extend the number comparison code found in "strnumcmp-in.h".

- Michael Speer


reply via email to

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