I have four files like so:
File 1 contents (tab separated, 3 columns):
applepen apple pen strawberry straw berry
File 2 contents:
File 3 contents(This file is sorted):
apple fan straw
File 4 contents(This file is sorted):
I need to compare field 1 of file 1 with file 2, field 2 of file 1 with file 3 and field 3 of file 1 with file 4. If all three matches are found, I want to print field 1,2,3 of file 1. I want to do this for each line in file 1.
The output here should be:
applepen apple pen
Is there any way to do this using grep or comm or something similar?