[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
numfmt enhancements to emulate df -g
From: |
Pádraig Brady |
Subject: |
numfmt enhancements to emulate df -g |
Date: |
Fri, 19 Jun 2015 20:08:14 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 |
On 05/06/15 17:52, Michael Felt wrote:
> michael@x071:[/usr/bin]/usr/bin/df -g .
> Filesystem GB blocks Free %Used Iused %Iused Mounted on
> /dev/hd2 3.00 0.18 94% 57355 54% /usr
> I guess what I could do is look at creating an alias so that
> a) look to see if df/du is not /usr/bin/df/du - and if so, use df -BG
I see that df -g on AIX gives precision of 2 decimal places.
We should be able to achieve that easily with numfmt.
Also numfmt should more easily process multi field output (from df).
These were already TODO items which I've now implemented in the attached patch
set.
This would allow you to setup an alias that does:
$ df -B1 | numfmt --field - --invalid=ignore --to-unit=G --format=%.2f
--suffix=G
Filesystem 1B-blocks Used Available Use% Mounted on
devtmpfs 4.13G 0.00G 4.13G 0% /dev
...
Dylan I used/adjusted your patch for multiple fields support.
Note I moved from an avltree to a linked list so that memory
consumption was proportional to the number of field specifications,
rather than the number of fields specified. One could have
done that with a tree also (an interval tree), but that would
have involved deeper integration in the tree insertion routines
to augment the range values. This would have been a false optimization
though since a better one is to take advantage of the fact we're doing
a linear scan, rather than random lookup, which cut does.
So I added a TODO to refactor the cut implementation
for use by both cut and numfmt.
cheers,
Pádraig.
numfmt-df-g.patch
Description: Text Data
- Re: Some options I would like to see on AIX, (continued)
- Re: Some options I would like to see on AIX, Michael Felt, 2015/06/05
- Re: Some options I would like to see on AIX, Pádraig Brady, 2015/06/05
- Re: Some options I would like to see on AIX, Eric Blake, 2015/06/05
- Re: Some options I would like to see on AIX, Michael Felt, 2015/06/05
- Re: Some options I would like to see on AIX, Michael Felt, 2015/06/05
- Re: Some options I would like to see on AIX, Bernhard Voelker, 2015/06/05
- Re: Some options I would like to see on AIX, Michael Felt, 2015/06/06
- Re: Some options I would like to see on AIX, Bernhard Voelker, 2015/06/07
- Re: Some options I would like to see on AIX, Michael Felt, 2015/06/08
- numfmt enhancements to emulate df -g,
Pádraig Brady <=
- Re: numfmt enhancements to emulate df -g, Pádraig Brady, 2015/06/19
- Re: numfmt enhancements to emulate df -g, Dylan Cali, 2015/06/19
- Re: numfmt enhancements to emulate df -g, Pádraig Brady, 2015/06/20
- Re: Some options I would like to see on AIX, Michael Felt, 2015/06/05