I\'m trying to compare two different files, let\'s say \"file1\" and \"file2\", in this way. If fields $2 and $3 are the same in both files, print $0 of file2. Here\'s an ex
awk 'NR==FNR{a[$2,$3];next} ($2,$3) in a' file1 file2
This awk
should do:
awk 'FNR==NR {a[$0];next} {for (i in a) if ($0~i) print}' file1 file2
E 25 692 1 4
E 510 744 1 8
E 352 697 1 10
It store the file1
in array a
. Then loop trough file2
and test if it contains the data from array a
, if yes, print the line.