I have multiple files (10+) that I want to merge/join into the one output file, for example:
file 1
2000 0.0202094
2001 0.0225532
2002 0.02553
2003 0.0261099
2004 0.0280311
2005 0.028843
file 2
2000 0.0343179
2001 0.036318
2003 0.039579
2004 0.0412106
2005 0.041264
file 3
2004 0.068689
2005 0.0645474
All files have the same two columns are are of unequal length.
The desired output would be:
file1 file2 file3
2000 0.0202094 0.0343179
2001 0.0225532 0.036318
2002 0.02553
2003 0.0261099 0.0395799
2004 0.0280311 0.0412106 0.0686893
2005 0.028843 0.041264 0.0645474
I have tried the following code however the values don't align with the first column:
awk '{printf($1); for(i=2;i<=NF;i+=2) printf ("\t%s", $i); printf "\n"}' <(paste file*) > mergedfile.txt