On May 21, 2009 5:07pm, Giuseppe Scrivano gscriv...@gnu.org 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
___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils