I have many files in a location where I need to list file names in which 32th column has value more than 3000.

This is the command that gives me those records:

awk -F, '$32 > 3000' *

Now can anyone tell me how can I get names of those files that have these records.


Just make use of FILENAME built-in variable:

awk -F, '$32 > 3000{print FILENAME; nextfile}' *

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.