Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

print line with a maximum value from a column

Status
Not open for further replies.

ancutza

Technical User
Dec 13, 2006
1
RO
i have a file with this output :

Dec 12 23:15:48 2006 28.57 13.49 5.69 9.39
Dec 12 23:20:48 2006 32.77 14.49 6.09 12.19
Dec 12 23:25:48 2006 27.18 13.49 4.40 9.29
Dec 12 23:30:48 2006 27.08 11.49 5.00 10.59
Dec 12 23:35:49 2006 24.58 10.69 4.80 9.09
Dec 12 23:40:49 2006 21.58 8.79 3.10 9.69
Dec 12 23:45:49 2006 19.18 8.49 3.80 6.89
Dec 12 23:50:50 2006 22.18 9.99 4.30 7.89
Dec 12 23:55:50 2006 19.98 8.49 3.80 7.69


i have to sort out the maximum value of the third column and print out that line. is that possible?


thank you in advance.
 
Do you have to use awk? I'm assuming the date takes up the first 3 columns:

Code:
sort -k 5,5 -n -r data.file|head -n 1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top