Friday, May 27, 2011

perl, unix: fastest way to merge thousands of small files into one file

The cat command works nicely:

cat *someglob* > output.txt

It's name (short for concatenate) even gives away its purpose.



OR


I'm sure cat is faster, and simpler, but here's a perl version, just
because you asked about it.

perl -we '@ARGV = glob("@ARGV"); print while (<>);' *.txt > all.csv

No comments: