hello gurus,
Somebody must have done this before, I couldn't find anything. Please redirect me if this was solved before, and if not please help.
To the problem now, I have multiple csv files (about 1000) which I need to concatenate by column header. The final file should have a superset of all columns of the csvs, and corresponding missing values should be blank.
All files are the same directory. Note the randomness and spaces in filenames.
File 2012 IBM 1
A,B,C
d1,d2,d3
d4,d5,d6
DELL2013 FILE_2
A,C,D
d12,d22,d32
d42,d52,d62
HP File 3
B,C,D,E
d22,d122,d132,
d32,d152,d262,142
My output should look like
A,B,C,D,E
d1,d2,d3,,
d4,d5,d6,,
d12,,d22,d32,
d42,,d52,d62,
,d22,d122,d132,
,d32,d152,d262,142
I can do this for files with common columns in the same order, but this cant incorporate new columns in the superfile
awk 'FNR==1 && NR!=1{next;}{print}' *.csv