to list files:
try
awk 'FNR == 1 && $4 == "whatever" { print FILENAME ;}' file1 ... filen |
which will select all file having whatever in fouth colum.
If you have funny name, just add quotes.
awk 'FNR == 1 && $4 == "whatever" { printf "\"s\"\n", FILENAME ;}' file1 ... filen |
to process one file
awk 'NR == 1 && $4 != "whatever" { exit ;} other patterns { other action;}' file
to process many file
awk 'NR == 1 && $4 != "whatever" { nextfile ;} other patterns { other action;}' file1 ... filen
which could be read as
- IF (condition not met)
NR == 1 && $4 != "whatever"
- THEN skip this this file
{ nextfile ;}
- ELSE proceed
other patterns { other action;}