I have to match each row in file 1 with 1st row in file 2 and print the corresponding column from file2. I am trying to use an awk script to do this. For example
cat File1
X1
X3
X4
cat File2
ID X1 X2 X3 X4
A 1 6 2 1
B 2 7 3 3
C 3 8 4 1
D 4 9 1 1
Desired output is
cat File3
X1 X3 X4
1 2 1
2 3 3
3 4 1
4 1 1
It will be really helpful if anyone can suggest how to do this in awk.