sry opening a new thread but awk is driving me nuts! >< im trying to run a few command assignments inside a single awk but i cant get it to work please help if this is ez for u :P i can't get the syntax to work
edit: im using /bin/bash
for f in `seq $nlinpE $loopE`;
do
awk -F ","'
BEGIN {}
'$f' { dataI2[$f]=$2;
dataI3[$f]=$3;
dataI4[$f]=$4;
noD1[$f]=$dataI1[$f];
noD2[$f]=$dataI2[$f];
noD3[$f]=$dataI3[$f];
noD1i[$f]=`echo "$nlinpN1 + $dataI1"|bc -l`;
noD2i[$f]=`echo "$nlinpN1 + $dataI2"|bc -l`;
noD3i[$f]=`echo "$nlinpN1 + $dataI3"|bc -l`;
}
'${noD1i[$f]}' {
dataIi2[$f]=$2;
dataIi3[$f]=$3;
dataIi4[$f]=$4;
}
'${noD2i[$f]}' {
dataIii2[$f]=$2;
dataIii3[$f]=$3;
dataIii4[$f]=$4;
}
'${noD2i[$f]}' {
dataIiii2[$f]=$2;
dataIiii3[$f]=$3;
dataIiii4[$f]=$4;
}
END{}
' <aoa_5.inp;
done
input is like:
17, 3.22854114, 0.562598288, 0.384291202
18, 2.96085286, 0.085116826, 0.285071939
19, 3.40070796, 2.27838659, 0.302027524
20, 3.20035744, 0.333615214, 0.262585849
21, 2.85644341, 0.258691043, 0.369726121
22, 3.73537922, 1.3267405, 0.295917094
23, 3.69372559, 1.32601321, 0.306054831
24, 3.28857207, 0.63199228, 0.378117412
25, 3.27523994, 0.695856452, 0.377585977
imjust assigning variables atm, getting the number w/o commas
i get this syntax type of error:
awk: 9: unexpected character '`'
awk: 10: unexpected character '`'
awk: 11: unexpected character '`'
(standard_in) 2: syntax error
(standard_in) 2: syntax error
awk: line 1: syntax error at or near {
^C
thx
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…