I am trying to find a file with in a dir that contains the largest number (at position 3rd row 3rd column). I want both the max value and the file name containing max value printed. This is what i have right now
find ./ -name sample-file\* -exec sed '3!d' {} \; | awk '{print $3}' | awk 'n<$1{n=$1}END{print n}'
This gets me the max value, but i also want the file name containing the max value. Print along with this.
Current output:
When run for dir1:
487987
When run for dir2:
9879889
I want the output to be like this
when run for dir1:
file16 487987
when run for dir2:
file23 9879889
Appreciate some inputs on this. Thanks