Which way is the simplest
I am not sure what do you mean by simplest. For this problem,
you can simply use join
:
join -j 2 -o 1.1 1.2 1.3 2.3 file1 file2
For the given example, the above command generates the desired output. If your file is not sorted, you can also add --nocheck-order
option.