I want to split sourcefile.txt which contains 10000 lines, (increasing everyday) into 30 equal files. I have foldersdirectories called prog1 to prog30 and I would like to save split the file into these foldersdirectories with athe same filename. For example /prog1/myfile.txt, /prog2/myfile.txt to /prog30/myfile.txt. I searched but I couldn't find any similar questions.
The script runs in prog folder and
Here is my bash script called divide.sh
My bash script is below runs in prog directory
#!/bin/bash
programpath=/home/mywebsite/project/a1/
array=/prog1/
totalline=$(wc -l < ./sourcefile.txt)
divide="$(( $totalline / 30 ))"
split --lines=$divide $./prog1/myfile.txt
exit 1
fi
#!/bin/bash
programpath=/home/mywebsite/project/a1/
array=/prog1/
totalline=$(wc -l < ./sourcefile.txt)
divide="$(( $totalline / 30 ))"
split --lines=$divide $./prog1/myfile.txt
exit 1
fi