Member-only story

Combine Multiple CSV Files Into One CSV Using Shell Scripting

Josh Otwell
3 min readAug 13, 2024

--

Shell scripting simplifies the merging of multiple CSV files by automating repetitive tasks, ensuring data consistency, and saving time compared to manual methods.

In my (current) day job, I often have to combine a large number of CSV files into 1 single CSV for uploading, parsing, and other analysis.

Image by LapinVert from Pixabay

From a Windows cmd prompt, the command to do this is a simple, one-liner, executed in the folder where all the CSV’s are located:

copy *.csv NewFileName.csv

The macOS (and Linux) version of this is a bit more involved.

But doable.

I have 3 CSV files created in Google Sheets that I am going to merge into 1 CSV.

Names1.csv file contents:

Names2.csv file contents:

Names3.csv file contents:

--

--

Josh Otwell
Josh Otwell

Written by Josh Otwell

SQL/PHP | Photography | Technical Consultant. Sign-up for my free developer newsletter, OpenLampTech, here: openlamptech.substack.com

No responses yet