Entering edit mode
6.5 years ago
mittu1602
▴
200
I have an awk command which runs well on terminal: this awk command creates diffrent file according to their column header. awk command:
for((i=2;i<5;i++)); do awk -v i=$i 'BEGIN{OFS=FS="\t"}NR==1{n=$i}{print $1,$i > n".txt"}' ${Batch}.result.txt; done
the same command when incorporated in a shell script shows error:
Syntax error: Bad for loop variable