smatter
smatter

Reputation: 29178

Merging multiple csv files

I have many 1GB csv files. What is the easiest way to merge them. Can this be done using shell commands or do I have to write a C++ program for it.

Upvotes: 1

Views: 1092

Answers (1)

C. K. Young
C. K. Young

Reputation: 223003

cat *.csv > mega-merged.csv2
mv mega-merged.csv2 mega-merged.csv

(The use of the .csv2 is so that the *.csv doesn't catch it.)

Re Joce's comment, if you have headers, you can trim off all the headers (on GNU/Linux or any other platform with GNU tools) using something like:

tail -qn +2 *.csv > mega-merged.csv2

Upvotes: 2

Related Questions