Passing variables into awk from bash -
i writing shell script file in have print columns of file. try use awk. column numbers calculated in script. nprop variable in loop, changes 1 8.
avg=1+3*$nprop awk -v a=$avg '{print $a " " $a+1 " " $a+2}' $filename5 >> neig5.dat
i have tried following also:
awk -v a=$avg '{print $a " " $(a+1) " " $(a+2) }' $filename5 >> neig5.dat
this results in printing first 3 columns time.
avg=1+3*$nprop
this set $avg
1+3*4
, literally, if $prop
4 instance. should evaluating expression:
avg=$(( 1+3*$nprop ))
and use version of awk
script parenthesis.
Comments
Post a Comment