I have file which has pattern to be search in all these 4 files. I want the output only when the search pattern is available in all the 4 files. Also I would like to have file written out patterns which is not present in all 4 files.
In the example input files I have mentioned we have "zzz" in all files, but with the given awk it is not getting printed out. Also I would need to print the values of 2nd column for the matching inputs from each of the 4 files.
> awk 'NR==FNR{a[$1];next} $1 in a {c[$1]++} END {for ( i in c) if (c==4) print i}' list f1 f2 f3 f4
cde
fdf