I would like to process 2000 files on a 64 core machine. I have a python script foo.py
which I run like this:
cat file0000.txt|./foo.py > out0000.txt
Ideally I would to split the 2000 files file0000.txt to file01999.txt into forty sets each of size 50 and run foo.py on each set in parallel. For sets 1 to 4 out of 40 that would be the equivalent of the following:
cat file00[0-4][0-9] |./foo.py > outfile1.txt &
cat file00[5-9][0-9] |./foo.py > outfile2.txt &
cat file01[0-4][0-9] |./foo.py > outfile3.txt &
cat file01[5-9][0-9] |./foo.py > outfile4.txt &
Sadly the system I am running this on doesn't have parallel
so I have to do this without that very useful tool.
Bash script processing commands in parallel looks similar but the most popular answer is not directly relevant and the second most popular answer uses parallel
which I don't have access to.