I have two tab-separated files:
File 1
123 456
135 567
234 478
File 2
123 notimportant notimportant2
456 notimportant notimportant2
987 notimportant notimportant2
135 notimportant notimportant2
234 notimportant notimportant2
478 notimportant notimportant2
I need to extract lines from file1 if both entries in a single row are present in file2's first column. So the output file should be like:
Output
123 456
234 478
I previously used this awk command to extract rows if only the first column of file1 matched 1st column of file2
awk 'FNR==NR{a[$1];next}($1 in a){print}' file2 file1
But I don't know how to expand it.