[ILUG] ugly df
Badger
badger at scattermail.com
Sat Nov 11 12:57:49 GMT 2006
On Sat, Nov 11, 2006 at 07:51:20AM +0900, Josh Glover wrote:
> On 11/11/06, Paul Reilly <paulr at maths.tcd.ie> wrote:
>
> >Anyone know a simple way to make df display it's output nicely?
>
> <snip/>
>
> >I suppose you could do this by recompiling, or wrapping 'df' in some
> >script to format it nicely. But there must be a better way.
>
> Wrapping df in a script, or better yet piping its output to another
> program or programs is The Unix Way. Kitchen-sink options-having
> programs like GNU ls(1) are not The Unix Way. :)
>
Yeah, a script is the way to go here. You can do the sorting part on the
command line quite cleanly with the following perl:
df -h | perl -e "@t = <>; print shift @t; print sort @t;"
But to join up broken lines and get the whole output to look pretty
is a bit too nasty for any one-liners that I know.
- badge
More information about the ILUG
mailing list