bug#20442: bug+patch: du output misaligned on different terminals
From:
Pádraig Brady
Subject:
bug#20442: bug+patch: du output misaligned on different terminals
Date:
Tue, 28 Apr 2015 01:28:47 +0100
User-agent:
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0
On 28/04/15 01:13, Linda Walsh wrote:
> reopen 20442
> thanks
> =======
>
> Your more general case doesn't work:
>
>> du -sh /tmp/t*|numfmt --format %10f
> numfmt: rejecting suffix in input: ‘4.0K’ (consider using --from)
>> du -sh --time /tmp/t*|numfmt --format %10f
> numfmt: rejecting suffix in input: ‘4.0K’ (consider using --from)
You can use:
du -h --time | numfmt --from=iec --to=iec --format %10f
Though more naturally you can use:
du -B1 --time | numfmt --to=iec --format %10f
Since these are formatting for human consumption,
there are varying preferences etc, and so
(variants of) the above are appropriate for aliases,
or shell functions if accepting parameters.
> I usually use other arguments with 'du'. Your external tool solution
> doesn't handle the general case of "du's" output.
>
> The point was to correct 'du's output, not find a *custom* solution
> to correct assumptions made by 'du'.
>
> Why would you reject something that fixes this problem?
There are backwards compatibility issues to consider.
cheers,
Pádraig.