Is there a way to compare 2 files by columns and print matching cases.
I have 2 files as below, I want cases where col1 and col2 in f1 matches col1 and col2 in f2 to be printed as output. The separator is space. I want the output to have col1 col2 col 3 from both files printed in same line. Please see below example.
> cat f1
a b 1
c d 3
e f 0
f b 4
h h 0
x y 5
> cat f2
f d 1
h h 0
f b 4
e f 2
c d 3
a b 1
y x 5
> Desired output
a b 1 a b 1
c d 3 c d 3
e f 0 e f 2
h h 0 h h 0
f b 4 f b 4