I'm a new in bash scripting. I need a help in how to print the loop index to a file using awk? Here is the code I used.echo Write the start and end file number:read sta endecho $sta $endfor (( c=$sta; c<=$end; c++ ))do  echo $c  awk '{if (NR < 15 && $8 >0.48 && $8 <0.52 && $9 >0.48 && $9 <0.52 && $10 >0.48 && $10 <0.52) {print $1   $8   $9   $10}}' RD00$c/MergerHalos.out >> center_raw.datdoneIn addiction to the 1,8,9,10th column values, I need to write the value of cto center_raw.dat. 
How to print loop index to a file using awk?
shell script;awk
I am not sure what your requirement is but from what i infer below seems to be what you require:awk -v var=$c '{if (NR < 15 && $8 >0.48 && $8 <0.52 && $9 >0.48 && $9 <0.52 && $10 >0.48 && $10 <0.52) {print var : $1   $8   $9   $10}}' RD00$c/MergerHalos.out >> center_raw.dat-v option of awk is used to pass the external bash variable's value inside awk.