Hi,

On Tue, 3 Apr 2007 14:23:28 +0200 [EMAIL PROTECTED] wrote:

> I used to deal with --si or -H when using df as an example. By default,
> size unit is byte, but when you want to understand the numbers with no
> mental extra operation, It is quite good to print the more suitable
> unit.
> 
> Let's see my previous example:
> 
> [...]
> Total transferred file size: 3030220 bytes
> [...]
> 
> well, if a 'human readable option' was available, we can imagine the
> output to be:
> 
> Total transferred file size: 2.89 Mb
> 
> Is there any way to do that ?

I think it would be easy to come up with a simple perl script that
replaces occurences of "nnn bytes" with something adequate.

E.g.:

$ emerge --sync 2>&1 | perl -pe 's/(\d{1,3})(\d{3})\d{3}\sbytes/\1,\2 MB/ || 
s/(\d{1,3})(\d{3})\sbytes/\1,\2 kB/'

It wouldn't be too hard to adopt it to non-SI units (i.e. div 1024),
but I'm too lazy.

-hwh
-- 
gentoo-user@gentoo.org mailing list

Reply via email to