I've got three .csv files:
File1.csv
Header1
data1;data2;data3
File2.csv
Header2
data1;data2;data3
data1;data2;data3
File3.csv
Header3
data1;data2;data3
I want to join them like this:
Header1; ; ;Header2; ; ;Header3; ;
data1 ;data2;data3;data1 ;data2;data3;data1 ;data2;data3
; ; ;data1 ;data2;data3; ; ;
I've been trying to join the files with paste
, however the columns keep mixing up. I think this happens because sometimes one of the files has no data (only the header) or File2.csv has more data than File1.csv. In this case it should look like this:
Header1; ; ;Header2; ; ;Header3; ;
; ; ;data1 ;data2;data3;data1 ;data2;data3
; ; ;data1 ;data2;data3; ; ;
Is paste
the best way to accomplish this?
ps. I can change the way the .csv files are created. I'm now using semicolons as delimiter but this can be changed if it makes it easier.