I have tried various solutions given in this site for this kind of problem and none of these are helping me out.
I have two files (space-separated, contains columns). Both the files contain the same number of records as given in my examples below.
Let me call the columns as A, B, C ... (These are the column headers.)
File 1:
A B C D
-----------
a1 b1 c1 d1
a2 b2 c2 d2
a3 b3 c3 d3
a4 b4 c4 d4
a5 b5 c5 d5
File 2:
E B A F
---------
1 b5 a5 f
2 b2 a2 f
1 a1 b1 f
1 a3 b3 f
2 a4 b4 f
I want to produce the merged file:
A B C D E
-------------
a1 b1 c1 d1 1
a2 b2 c2 d2 2
a3 b3 c3 d3 1
a4 b4 c4 d4 2
a5 b5 c5 d5 1