bug-coreutils
[Top][All Lists]
Advanced

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

Re: Human readable sort


From: Michael Speer
Subject: Re: Human readable sort
Date: Sun, 26 Apr 2009 01:41:44 -0400

2009/4/25 Pádraig Brady <address@hidden>:
>
> I've further modified your latest in the attached.
> I refactored the suffix finding a bit and also added
> support for --sort=human-numeric.

I refactored it again to handle some potential problems with how
separators and decimals points were handled.  It will still let you
write something silly like "1,3,4.5.6", but I've stopped scanning on
"4..4" or "3,,2" or even "5.M".  I'm not sure if that last one is used
meaningfully anywhere.  I did this partly to avoid breaking locales
where space is the separator.  `du --h --apparent-size` output like
this :

>> 4    TO-DO
>> 5    Million-dollar-idea
>> 3K  whatever

would have triggered the mixed prefix error spuriously due to the
greedy consumption of space in the second line.  I am not concerned
with making it parse intelligently for all the various locales, but
only to make sure it doesn't do anything particularly stupid.

http://en.wikipedia.org/wiki/ISO_31-0#Numbers

It appears ISO suggests the space for separator.  I poked around a bit
to see if any locales used space.  Apparently, the Hungarian locale
does.  I stopped looking there.

> I'm wondering whether "numeric" is superfluous?
> I.E. are --sort=human and --human-sort sufficient.
>

I started with just human, but thought it better to add the numeric
since sort is by default for strings, and both current switches that
enable numeric sorts have it in their name.  I would not fight a
reversion on this if no one thought it would look confusing or too
inconsistent to end users.

-Michael Speer

Attachment: diff.diff
Description: Text Data


reply via email to

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