Merge CSV files from a command prompt

I had a bunch of CSV files I needed to merge. I don’t spend half an hour loading all of them into Excel and doing a bunch of copying and pasting. Here’s how I merge CSV files from a command prompt.


copy /b file1.csv+file2.csv+file3.csv master.csv

That’s all there is to it. Load the resulting file into Excel, remove the duplicate header rows, and I have one big, master CSV file to work with in a matter of seconds. You can concatenate as few or as many files as you want this way. I happened to have 20, so this bit of command line trickery probably really did save me half an hour.

2 thoughts on “Merge CSV files from a command prompt

  • January 31, 2014 at 2:01 pm
    Permalink

    I probably would have used Type and redirect, and after the first line, filtered the header:

    Type file1.csv > master.csv
    type file2.csv | filter “header” >> master.csv
    type file3.csv | filter “header” >> master.csv

    But then I’m old skool. 😉

  • January 31, 2014 at 2:03 pm
    Permalink

    Er, Find /v. I forgot I wrote a batch file called “filter” that does it for me. Sigh…

Comments are closed.

%d bloggers like this:
WordPress Appliance - Powered by TurnKey Linux