views:

36

answers:

3

I have a bunch of files in a directory, each with one line of text. I want to cat all of these files together (all the one liners) into a single, large file. However, when I use cat there are too many arguments. How can I get around this?

+2  A: 

look into xargs

find . <whatever> | xargs cat > outfile.txt

Replace the find . <whatever> bit with your own way of getting all the files

Replace outfile.txt with your output file.

John Weldon
+3  A: 
bash$ (ls | xargs cat) > /tmp/some_big_file
MikeyB
+1  A: 

try to use -n with xargs to reduce the number of arguments passed to cat

find .|xargs -n 100 cat >> out
oraz