Site icon Mister Dif Reviews

How to merge multiple CSV-files into one with Mac OS X Terminal.app

mac terminal icon

Found this csv merge tutorial and it works great to merge csv files on mac into one file.

An explanation and quick piece of code that will help you to simply merge large numbers of .csv files (or for that matter: any kind of text files) into one. I used it to merge multiple .csv files with differing filenames into one. Quick & easy.

  1. Put all of your .csv files into one folder and open the folder in terminal on the Mac.
  2. Run this command in terminal on the folder:
cat *.csv >merged.csv

 



To specify which files you want to merge use:

cat file1.csv file2.csv file3.csv >merged.csv

Note that each file must have the same number of columns.

More things you can do with Terminal on the Mac

Exit mobile version