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

Re: [Sheflug] Using awk



On Thursday 27 January 2005 16:41, Jonathan wrote:
> Jonathan wrote:
> > Imran Javeed wrote:
> >> Hello all
> >>
> >> I'm trying to modify the out put of df, I would like the output as is
> >> but would like the last column alphabetically sorted.
> >>
> >> I've tried using 2 lines of code for this and pasting the code back
> >> together in a text file, is this the best way to do it or is there an
> >> easier way....
> >
> > Well, maybe it would be easier if you looked at printing the last column
> > first, something like:
> >
> > df | awk '{print $NF" "$0}' | sort | cut -f2-
>
> How about this?
>
> root [at] server# df | awk /%/ | sort +5
> /dev/ar0s1a   1012974    53260   878678     6%    /
> devfs               1        1        0   100%    /dev
> /dev/ar0s1d   1012974     9490   922448     1%    /tmp
> /dev/ar0s1f  65327520 15440068 44661252    26%    /usr
> /dev/ar0s1e   8122126    62762  7409594     1%    /var
>
> - J


In the above line 

root [at] server# df | awk /%/ | sort +5

what is the awk /%/ actually doing, what difference is it from

df | sort +5

could someone please explain?

Imran
___________________________________________________________________

Sheffield Linux User's Group -
http://www.sheflug.co.uk/mailfaq.html

  GNU the choice of a complete generation.