简体   繁体   中英

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM