Skip to content
Advertisement

Combine multiple files csv into one using awk

I want to combine two .csv files based on the unique id that exists in both files. First file consist of 17 columns and the second one in 2 columns where in both files the first column is the same unique id. In the to be created file 3 i would like 18 columns. I have been trying paste

paste -d ‘ ‘ SPOOL1.csv SPOOL2.csv > MERGED.csv

but that of course does not take the unique columns into consideration. Not proficient in awk so all help is appreciated. Thanks

Advertisement

Answer

sounds like if the files are sorted then
join SPOOL1 SPOOL2 > MERGED
should get you closer if you deal with the delimiters not shown

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement