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 running script with the commands as:

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

But 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?

  • What's wrong with putting the commands into your script? Why won't that work for you? Oct 28, 2019 at 11:58
  • I am running script with the cmds as: cat $full/blank/ascii/*/*xyz > $full/blank/ascii/output.txt then 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 havefull pathway at the start of the file too
    – AJOS
    Oct 28, 2019 at 12:14
  • Please would you put that update into your question, where it can be seen and easily read by everyone. Oct 28, 2019 at 12:30
  • The error message you see would indicate that the expression $full you are using in your path specifications is undefined (notice the path it reports starts with /blank?). Perhaps if you posted the script, too, the community might be able to help in debugging it.
    – AdminBee
    Oct 28, 2019 at 12:32
  • thank you, I corrected my $full path, it is now running. just need to send the new files to the correct folder
    – AJOS
    Oct 28, 2019 at 12:35

1 Answer 1


You haven't defined $full, so the command cat $full/blank/ascii/*/*xyz > $full/blank/ascii/output.txt is being evaluated with that as an empty string:

cat /blank/ascii/*/*xyz > /blank/ascii/output.txt

Furthermore, since the interpreter reports that this is on line 1 of your script, I would guess you've not got a #! interpreter defined there yet. I would really recommend you get used to providing one of these at the start of every script you write.



cat $full/blank/ascii/*/*xyz > $full/blank/ascii/output.txt
split -b 2000m $full/blank/ascii/ouput.txt
  • Thank you, I have edited the currect $full path and it now runs. I just need out to edit my split cmd to send output files to seperate folder with a .txt prefix
    – AJOS
    Oct 28, 2019 at 12:57
  • thank you for the help. Would you know how i can use the split command to send created files to a separate folder with a new .txt prefix? many thanks
    – AJOS
    Oct 28, 2019 at 14:15
  • @AJOS man split and look for the PREFIX option Oct 28, 2019 at 14:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .