Rohit G Rohit G - 1 year ago 71
Linux Question

Combine 3000k txt files into one txt file Linux

I want to combine 3000k txt files in one txt file
Tried this:

cat ./data/*.txt >>final1.txt

But this is gives an error

bash: /bin/cat: Argument list too long

How to do this

Answer Source

You can use find for that:

find ./data/ -name "*.txt" -exec cat "{}" \; >>final1.txt

* expansion has limits because bash expands it into every single filename and arguments are limited by kernel setting MAX_ARGS_PAGES (see

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download