[Top][All Lists]

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

Re: Adding humanize_number to coreutiles?

From: Jim Meyering
Subject: Re: Adding humanize_number to coreutiles?
Date: Tue, 14 Feb 2012 17:19:24 +0100

Pádraig Brady wrote:
> On 02/14/2012 12:59 PM, Jim Meyering wrote:
>> Pádraig Brady wrote:
>> ...
>>> Looking more at this, you might be right.
>>> Now printf already has related formatting functionality:
>>> $ env LANG=fa_IR.utf8 printf "%I'd\n" 1234
>>> ۱٬۲۳۴
>>> I was thinking it would be appropriate to add "human" into the mix like
>>> $ env LANG=fa_IR.utf8 printf "%Hd\n" 1234
>>> 1K
>>> $ env LANG=fa_IR.utf8 printf "%HId\n" 1234
>>> ۱K
>>> But as you say there are options for humanizing.
>>> So would there be enough cohesive functionality one could add to such a 
>>> util?
>>> I suppose so, since one could add field processing and
>>> multiplier support for example.
>>> Also what to call it? humanize_number is too long I think.
>>> Perhaps we could use a more general name. Drats I was
>>> thinking of `numconv`, but that's taken:
>>> Maybe `convnum`, anyway...
>> human-readable   too long and hyphenated
>> hr               short, but in the unix tradition (like od, dd, etc.)
> Hmm, well "humanize" might be a bit of an amorphous term
> to have as the base verb for the command.
> Perhaps adding a --human option is clear enough,
> since it would not be the only mode of operation.
> I.E. support `convnum -h`, where:
>   -h, --human  Same as --to=SI
> I'm not that happy with convnum though.
> What about `numfmt`. Shorter than convnum,
> we already have `fmt`, and the util presented
> has a central --format option.
> So what I have so far is:
> numfmt [OPTIONS] [NUMBER]...
> Reformat NUMBER(s)
> Numbers can be processed either from stdin or command arguments

So far, numfmt is my favorite, too.
Good that it starts with "num", and not too long.

You might want to say something about readability of the result.
"Reformat" all by itself is just too vague unless you give an example like
"Reformat numbers like 11505426432 to the more human-readable 11G"

reply via email to

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