Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

bash list the top ten largest values in a column

# Example usage:
sort -k3n,3 input_file | tail -10
# Here we sort the input_file in numerical order based on the third 
# field and then pipe to tail to print the last ten rows. 

# If you only want to return specific fields from the sorted file, pipe
# to cut. E.g. to return the largest values from the third field:
sort -k3n,3 input_file | tail -10 | cut -f 3
Source by unix.stackexchange.com #
 
PREVIOUS NEXT
Tagged: #bash #list #top #ten #largest #values #column
ADD COMMENT
Topic
Name
1+2 =