[Top][All Lists]

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

Re: sort ignoring human readable suffixes

From: Paul Eggert
Subject: Re: sort ignoring human readable suffixes
Date: Sun, 05 Sep 2004 16:49:38 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Lucas Nussbaum <address@hidden> writes:

> So 12345K < 1M, but I think it is acceptable if
> properly documented (no software will never output 12345K).

Unfortunately some software does output "12345K".  For example:

$ echo '' | dd bs=1 seek=12641279 of=big
1+0 records in
1+0 records out
$ ls -l --block=K big
-rw-r--r--  1 eggert eggert 12345K 2004-09-05 16:42 big

I don't see an easy, efficient fix for this.  If we want to be able to
handle binary multipliers like the "K" above, and we want to avoid
errors, we need to have multiword arithmetic.

> Oh and it is just sort -h, not sort -hn.

It's OK for -h to imply -n, but it'd be nice if it could also be
combined with -g.  Come to think of it, if -h implied -g instead, you
might have a simpler implementation (albeit one with rounding errors
and slower performance).

reply via email to

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