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

Re: [Sheflug] Using awk



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-

That will give you alphabetical but with the heading still in there.

I'm a piper rather than a coder, so it's never going to be elegant!

- J


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.7.4 - Release Date: 25/01/2005

___________________________________________________________________

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

GNU the choice of a complete generation.