I want to split sourcefile.txt which contains 10000 lines, (increasing everyday) into 30 equal file. I have folders called /prog1/ to /prog30/ I would like to save split files into these folders with a same filename. For example /prog1/myfile.txt /prog2/myfile.txt to /prog30/myfile.txt I search but it couldn't find near my question. Thank you.
script runs in /prog/ folder called divide.sh
My bash script is below
#!/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