Saturday, October 07, 2006

Combine Contents of Multiple Files Into One.

Two days ago, I had to combine 8 large data files into one. Each file contained a list of CSV data that needed to be parsed into one file. Here's what I did.

#cat file1 file2 file3 file4 file5 file6 file7 file8 > mynewfile

more examples...

#cat file1 file2 > newfilename

#cat file1 file2 file3 > newfilename

#cat file1 file2 file3 file4...filen > newfilename (You should be getting the idea by now...)

The ">" system is a redirect.

By the way, cat is short for concatenate or join.

No comments: