Hi, I was wondering if someone could help with what is probably a fairly easy problem. I have two variables, i is between 1-5, j is between 11-15
I'd like to produce this:
1_11
2_12
3_13
4_14
5_15
Each number goes up incrementally with the other.
But my shoddy code is not playing ball:
END=5
END2=15
for ((i=1;i<=END;i++))
do
for ((j=10;j<=END2;j++))
do
echo "$i"_"$j"
done
done
And is producing:
1_11
1_12
1_13
1_14
1_15
2_11
2_12
2_13
2_14
2_15
3_11
3_12
3_13
3_14
3_15
4_11
4_12
4_13
4_14
4_15
5_11
5_12
5_13
5_14
5_15
As you can see, this is not what I what I had intended
This is a small scale example - in reality i is between 1000-6000 and j is between 7000-12000 and I am creating files with this template "$i"_"$j".txt
Using this code, I am getting thousands of unwanted files. I just want $i to increase with $j, rather than every possible combination of $i and $j.
Any help using shell (rather than python/perl) scripting would be very much appreciated.