My question is similar to this one: Merge multiple columns based on the first column values
I have multiple files (10+) that I want to merge/join into one output file, for example:
file 1
2000 0.0202094
2001 0.0225532
2002 0.02553
2003 0.0261099
2006 0.028843
file 2
2000 0.0343179
2003 0.039579
2004 0.0412106
2006 0.041264
file 3
2001 0.03
2004 0.068689
2006 0.0645474
All files have the same two columns and are of unequal length. Where there is no entry for the columns (missing in one or several files), I would want a 1. If there is no entry in any file (like 2005) I don't want any output.
The desired output would be:
file1 file2 file3
2000 0.0202094 0.0343179 1
2001 0.0225532 1 0.03
2002 0.02553 1 1
2003 0.0261099 0.0395799 1
2004 1 0.0412106 0.0686893
2006 0.028843 0.041264 0.0645474
I have tried to modify the awk code provided by the answer of this other question, but I feel like it could not be possible with that solution.