Skip to main content
4 of 5
Format code as code with the {} button. Again.
Chris Davies
  • 128.1k
  • 16
  • 178
  • 323

Combining .txt files but limiting the combined file into sized chunks

I have a batch of .txt files I want to combine so I can import into another program. This program is limited by 2GB data packets at a time but the total of the files will be 20GB.

Is it possible to combine the .txt files, limiting to 2GB each time, giving a total of 10x 2GB combined files? I'd like to add it to a script.

I am using the cat *.txt > (file) name and then split -b 2000m at the moment via commands, manually.

I am running script with the commands as:

cat $full/blank/ascii/*/*xyz > $full/blank/ascii/output.txt
split -b 2000m $full/blank/ascii/ouput.txt

When I run this, it says

line 1: /blank/ascii/output.txt: no such file or directory.

I have the full pathway at the start of the file too. Is it also possible to split a file and send the output to seperate folder?

AJOS
  • 3
  • 2