I want to match column 1 of file.txt with column 2 of test.txt to replace column 2 of test.txt with corresponding column 1,2 and 3 from files.txt. Can someone suggest best approach for this using a bash script?
Below are 2 files: test.txt
pcs_err 102 0 1580917083
too_long 103 0 1580917083
emc_out 103 0 1580917083
too_long 104 0 1580917083
emc_out 104 0 158091708
link_failt 104 0 1580917083
loss_sig 104 0 1580917083
file.txt
102 1 10 0efd40 N16 Online F-Port 52:4a
103 1 11 0e5e00 N16 Online F-Port 20:01
104 2 0 0e2200 N16 Online F-Port 20:01
105 2 1 0e5700 N16 Online F-Port 20:01
Desired output would look something like below,
pcs_err.1.10.102 0 1580917083
too_long.1 11.103 0 1580917083
emc_out.1.11.103 0 1580917083
too_long.2.0.104 0 1580917083
emc_out.2.0.104 0 158091708
link_failt.2.0.104 0 1580917083
loss_sig.2.0.104 0 1580917083