Let's say I want to generate a series of numbers that first jump 5 and then 10 all the way to 100 which would be
0,5,15,20,30,35,45,50,60,65,75,85,90,100
I am aware of
seq 0 10 100
but am looking to jump two different intervals intertwined.
On
You may use 2 printf statements to generate 2 lists and then sort the combined list using sort -n:
{ printf '%d\n' {0..100..15}; printf '%d\n' {5..100..15}; } | sort -un
0
5
15
20
30
35
45
50
60
65
75
80
90
95
As
bashis tagged: Useseqwith a step size that covers a whole cycle (here 5+10 = 15). Then, for each line, print the missing steps.If the intervals are more complex, calling
seqthat way could very well be nested again inside, like so for this example