For any sequential range of integers, n1..n2
how can I use command line tools to parse them into ranges of length <= n
?
Example
As a specific example, I have a directory with folders named 1253..2050
. Each folder has a script called job.sh
, and I can submit them in batches of 20 jobs (since each node has 20 cores). Thus, I want to generate the following commands:
Sample input:
echo {1253..1301}
For a particular case I can generate this sequence of integers using either /bin/ls
or cat runs.txt
.
Sample output:
qsub -t 1253-1272 array.pbs
qsub -t 1273-1292 array.pbs
qsub -t 1293-1301 array.pbs