i am trying to paste some large of files together. I would like to use paste. All the data has the same two column and i only want to print these two columns once.
For example
file1
h1 h2 i1
1 10 aa
2 20 bb
3 30 cc
file2
h1 h2 i2
1 10 xx
2 20 yy
3 30 zz
finaloutput
h1 h2 i1 i2
1 10 aa xx
2 20 bb yy
3 30 cc zz
I have around 3000 small files that need to be merged like this. I was wondering if there is a practical way of doing this? I can only think of using cut for each file and rename them
cut -f 3- myfile1 > myNewFile1
...
cut -f 3- myfile3000 > myNewFile3000
and then paste.
paste myNewFile* > FinalFile
I am hoping there is a more practical solution to this?