Home>
a # num b c d
0 131 3442 43465436
1000 331 42674 0.974549
2000 42424 59879 1358400
3000 242428 46846 54054540
・
・
・
・
・
There is a text file like the one above.
Of these, I want to find the maximum value in the third column from the left, and the number in the first column from the left in the same row.
In this case, I want to get the number 2000, because I want to move a file like aaa_2000.sh.
cat file.txt | awk '{if (m<$3) m = $3} END {print m}'
c
Now such an answer is returned.
How can I rewrite it? Also, how can I copy a file that contains the numbers in column a when I know the maximum value from a location?
Please tell me. Thank you.
-
Answer # 1
-
Answer # 2
cat file.txt | awk 'NR>1 {if (m<$3) {m = $3;a = $1;}} END {print a } '
It was made with. Thank you very much.
Related articles
- a program that finds the maximum value of each column and finds the minimum value from it
- c - program that outputs the maximum value from the four
- javascript - how to change value of another key with specific value in associative array
- python - i want to pull the value of a hard-coded model from another model
- about finding the maximum value using the java extended for statement
- python - i want to extract the maximum value each time in a list that counts consecutive values
- vba i want to enter in the cell of another book depending on the value of the cell of a specific book
- c - you get the wrong maximum value from an array element
- linux - scripts running on my mac don't work on another mac
- ruby on rails - how to set the maximum value + 1 in a specific column when generating a model with rails
- python how can i find the maximum value from a set of numbers without using max? as an example, please use (60, 30, 40)
- find exact value in csv file using linux command
- c# - i want to pass the value of a field to another class as an argument
- vba - fetch the row with the maximum value among multiple conditions
- java - display maximum value, minimum value, and average from multiple integers
- ruby - is there a way to use the value (variable data) in another class that has no inheritance relationship?
- [vbnet] i don't know how to pass a value to a combo box of another form
- javascript - i want to know why you cannot pass the value of an argument to another function
- swift - i get an error when i pass a value to another view controller
- c# - how to get the value of another dll's config file from an aspnet mvc project
Related questions
- i want to get the work log including the execution command on linux
- linux : gcc compilation error: error adding symbol: file in wrong format
- linux - unable to connect to 127001
- linux - i want to restrict operations to standard users on ubuntu 2004
- linux - i want to use ssh to sync files using lsyncd and rsync, but it fails
- linux - rsync fails to start
- linux - i want to sync files with lsyncd, rsync and ssh, but it fails
- linux - difference between /usr/bin and /usr/local/bin
- linux - tar zxvf crf++-058targz ⇒ cannot open: no such file or directory
- linux - i want to add a fixed value to the end of a specific file in the shell
cat file.txt | awk '{if (m<$3) {m = $3;a = $1;}} END {print a}'
What about?