max value


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting max value
# 1  
Old 11-28-2005
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.
# 2  
Old 11-28-2005
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  
Old 11-29-2005
Quote:
Originally Posted by vgersh99
multiple ways given the input file file.txt:
Code:
sort -r file.txt | tail -1

i am afraid this would fetch only the minimum value from the list (but the req was for maximum value)

try,

Code:
sort -n file.txt | tail -1

# 4  
Old 11-29-2005
you're right - must have been a long day.
thanks for the correction.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Searching max

Basically I have a file num1 which contains IP addresses I need to find max element of third number in IP address which is 25! And after that relating to max third number I need to find max fourth number which is 237 (6th line) (22 Replies)
Discussion started by: Manu1234567
22 Replies

2. Shell Programming and Scripting

Get the MAX value out of a column

I've the following data set. I would like to look at the column 3 and only use the rows which has the max value for column 3 Can we use the awk or sed to achieve it. 10 2 10 100 11 2 20 100 12 2 30 100 13 2 30 100 14 ... (7 Replies)
Discussion started by: rudoraj
7 Replies

3. Shell Programming and Scripting

Max number of variables?

Hi Folks.Just out of interest does anyone know if their is a maximum number of variables that korn shell supports and if so how do I query what it is?Cheers (1 Reply)
Discussion started by: steadyonabix
1 Replies

4. Shell Programming and Scripting

Max FTP sessions?

Hi, Can anyone please tell me - 1. The command to find the number of maximum FTP sessions that can be opened by a server with other servers? 2. The command to find the number of FTP sessions open on a server? (1 Reply)
Discussion started by: miltonkeynesguy
1 Replies

5. Shell Programming and Scripting

max connections aix

Sir's, the problem is i have script and 1 user in different 30 servers that ssh to our main server at the same time. Then after that may account automatically locked. I dont know what is the reason, is it the max connection of 1 user using ssh. Pls help. How to fix this. (0 Replies)
Discussion started by: invinzin21
0 Replies

6. Shell Programming and Scripting

Max NO of parameters

1> Can anyone tell me what is the maximum no of parameters that can be passed to a file 2> i have 100 files amongst which in 500 files i have a string which needs to be searched how would get the names of those files. (1 Reply)
Discussion started by: Shivdatta
1 Replies

7. Shell Programming and Scripting

How i get the max value of a row?

I have a file like: <word> 5 <word> 3 <word> 5 <word> 2 <word> 6 <word> 8 <word> 12 and i need to know the max value of the second column, in this case 12. Plz help me! Actually i need the TOTAL, AVERANGE and MAX VALUE and i'm using this in... (10 Replies)
Discussion started by: Lestat
10 Replies

8. Shell Programming and Scripting

Finding max value

My code below is supposed to find which company had the most business and then print the appropriate fields from another file which are the companies ID number and name. I can loop through awk and display all the total amount of business for each company but I need help in only printing out the... (1 Reply)
Discussion started by: Enigma23
1 Replies

9. UNIX for Dummies Questions & Answers

Max I/O Size

My HP-UX 11.0 system is supporting an Oracle database. I have found a number of references on the Net to the "Max I/O size" in relation to setting Oracle parameters. How can I tell what my max i/o size is? I originally made the assumption that it was referring to my stripe size but now I think... (1 Reply)
Discussion started by: keelba
1 Replies
Login or Register to Ask a Question