hi,
can somebody explain me this?
probably i am overlooking something but i dont know what
why is not printed "7 9 11" instead of this?
$ echo "" | awk '{for(i=1;i<=3;i++){j=7;a=j;j=j+2;} print a[1],a[2],a[3]; }'
7 7 7
thanks
hi,
can somebody explain me this?
probably i am overlooking something but i dont know what
why is not printed "7 9 11" instead of this?
$ echo "" | awk '{for(i=1;i<=3;i++){j=7;a=j;j=j+2;} print a[1],a[2],a[3]; }'
7 7 7
thanks
You set j=7 at the start of each loop iteration. You should set it before the loop.
$ echo "" | awk '{j=7; for(i=1;i<=3;i++){a=j;j=j+2;} print a[1],a[2],a[3]; }'
7 9 11
thanks! i knew it must be something stupid