Hi,
I have a snippet like below.
Based on variable i, i wish to print 1,2,3,4,5th columns to Sample files.
For each loop, one column from contetn and results will be pused to sample files. But i have a problem here
i=1
while [ $i -le 5 ]; do
`awk -F"\t" '{print $($i)}' $content > Sample_${i}_original`;
`awk -F"\t" '{print $($i)}' $results > Sample_${i}_results`;
i=`expr $i+1|bc`;
done
Variable i is not being interpolated inside awk command
'{print $($i)}'
I tried many variations of it like
"{print $($i)}"
'{print $i}'
but nothing works.
How can i modify the code to make variable i is interpolated under print of awk command?
Appreciate your responses.