I have multiple txt files, 3 of them are like:
file1:
sample input filtered
5809378 1 2
5811151 3 4
5811237 5 6
file2:
sample chi tri
5809378 7 8
5811151
5811237 9 10
file3:
sample bra doe
5809378 11
5811151 12
5811237 13 14
I want to merge these 3 files into 1 based on the first column: sample ID, so the output would look like:
sample input filters chi tri bra doe
5809378 1 2 7 8 11 0
5811151 3 4 0 0 0 12
5811237 5 6 9 10 13 14
Notice that if there is no Corresponding data, there must be a zero, or in the worst case, an empty tab.
I have tried awk and join, and couldn't;t find a best solution. Anyone has any idea?