Rohit G Rohit G - 9 months ago 27
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


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