I have two files and want the matched records only in the output from both the files A temporary identification can be applied to both the files to determine the origin from where there come in the output.
INPUT-1:
----+----1----+----2----+----3----
VX2 GGGVX2 2460
BC2 MMMBC2 2160
GF2 KKKGF2 2460
VX2 GGGVX2 2460
BC2 MMMBC2 2160
GF2 KKKGF2 2460
INPUT-2:
----+----1----+----2----+----3----
VX2 GGGVX2 2442
VX2 GGGVX2 2442
GF2 KKKGFM 2442
GF2 KKKGFM 2442
GF2 KKKGFM 2442
GF2 KKKGFM 2442
J42 KRTJ42 2442
JK2 KRTJK2 2442
VX2 GGGVX2 2442
VX2 GGGVX2 2442
GF2 KKKGFM 2442
GF2 KKKGFM 2442
GF2 KKKGFM 2442
GF2 KKKGFM 2442
J42 KRTJ42 2442
JK2 KRTJK2 2442
OUTPUT WITH MATCHED RECORDS:
----+----1----+----2----+----3----+----4
VX2 GGGVX2 2460 1
VX2 GGGVX2 2442 2
VX2 GGGVX2 2442 2
GF2 KKKGF2 2460 1
GF2 KKKGFM 2442 2
GF2 KKKGFM 2442 2
GF2 KKKGFM 2442 2
GF2 KKKGFM 2442 2
VX2 GGGVX2 2460 1
VX2 GGGVX2 2442 2
VX2 GGGVX2 2442 2
GF2 KKKGF2 2460 1
GF2 KKKGFM 2442 2
GF2 KKKGFM 2442 2
GF2 KKKGFM 2442 2
GF2 KKKGFM 2442 2
Note: Both the files may contain duplicates and are NOT in sorted order.
Please suggest.
Thanks.