This is my whole script
#!/bin/bash
num_autocorellation=1
index_min=1
index_max=5000
for first in {1..10000..100}
do
for index in {$index_min..$index_max}
do
awk 'NR==FNR{a[$0]++;next}a[$0]-->0' eq3_900_915_dgdg_$first.ndx eq3_900_915_dgdg_$index.ndx | tee eq4_${num_autocorellation}_900_915_dgdg_$index.ndx
done
index_min=$(($index_min+100))
index_max=$(($index_max+100))
num_autocorellation=$(($num_autocorellation+1))
done
I want to have in the beginning in my nested loop something like that
for index in {1..5000}
do
awk 'NR==FNR{a[$0]++;next}a[$0]-->0' eq3_900_915_dgdg_1.ndx eq3_900_915_dgdg_$index.ndx | tee eq4_1_900_915_dgdg_$index.ndx
done
Then after this for loop will end I want to have
for index in {100..5100}
do
awk 'NR==FNR{a[$0]++;next}a[$0]-->0' eq3_900_915_dgdg_1.ndx eq3_900_915_dgdg_$index.ndx | tee eq4_2_900_915_dgdg_$index.ndx
done
and again again until 10000 in that loop
for first in {1..10000..100}
But I have a problem in this part
for index in {$index_min..$index_max}
Instead of integer I have in the file something like that
eq4_1_900_905_dgdg_{1..5000}.ndx
but I want to have
eq4_1_900_905_dgdg_1.ndx
So how to put here
for index in {$index_min..$index_max}
int variables?
-i inplaceis never necessary. Both of my answers mentioned in my previous comment showed you how to create a new file for each input file and stackoverflow.com/questions/66141434/… specifically does what you want to do here - generateeq4foofiles fromeq3foofiles while also displaying the output to stdout.print > outin that script is writing the output to a file whose name is stored in the variableoutthat is set earlier in the script to the input file name but with3changed to4(seeout = FILENAME; sub(/3/,"4",out)). The otherprintabove it is to mimictee.cmd infile | tee outfile- is that because you truly do want to get the output to display on stdout as well as be written tooutfileor is it just that that's the only way you know to write the output tooutfile? If you don't want the output to go to stdout too you then you'd just docmd infile > outfileprinton it's own in my script, justprint > out.