![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
max value
Hi All,
I want to choose the maximum value from a column values. eg - 234 23 567 43 2456 5 678 8978 from thses values how to choose the max value ? thanks. roger. |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
multiple ways given the input file file.txt:
Code:
sort -r file.txt | tail -1
nawk '{if ($0 > max) max=$0}END{print max}' file.txt
|
|
#3
|
|||
|
|||
|
Quote:
try, Code:
sort -n file.txt | tail -1 |
|
#4
|
||||
|
||||
|
you're right - must have been a long day.
thanks for the correction. |
||||
| Google The UNIX and Linux Forums |