Rohit G Rohit G - 4 months ago 10
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