I am trying to assign a awk array for further processing later in the script. I can't seem to figure it out. If someone could look at this and help me, I would very much appreciate it.
Thanks in Advance.
for ( x = 1 ; x <= Var ; x++ ) {
if ( x in varr ) {
printf "%s-%d %4.2f\n",Var,x,varr[x] / 360 > tst[$1]=$2 }
}
I am trying to assign tst[$1]=$2 with the output of the printf command
It's not clear what are you trying to do... With ">" symbol you are redirecting printf output to a file named like the content of tst[$1] element.
If I've understood correctly and you want to concatenate $2 with the output of the printf command and store the result in tst[$1], you need sprintf instead:
tst[$1]=sprintf "%s%s-%d %4.2f\n",$2,Var,x,varr[x] / 360
Thanks much for your help. Yes you were correct, I had to mess with the sprintf command, but I finally got it with:
tst[Var-x]=sprintf("%5.2f",varr[x] / 360) }