From: Mills, John T (John.T.Mills@ERAC.COM)
Date: Tue Feb 18 2003 - 13:44:31 EST
All,
I am trying to variablize the print portion
of the awk command. The reason for this is
processing a variable length string. The
string will be 7 fields long, and I need fields
1, 3, and 6 respectively. The set would be as
follows:
1 3 6
8 10 13
15 17 20
...
NNET is the number of sets of 7 in the string
#############################################
i=1
FACTOR=0
while [ "$NNET" -ge "$i" ]
do
let k=1+$FACTOR
let l=3+$FACTOR
let m=6+$FACTOR
echo $line | awk {'print $$k,$$l,$$m'}
let FACTOR=$i*7
let i=$i+1
done
#############################################
Thanks,
John T. Mills
This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:16:36 EDT