gawk multiply one field

Hi,

I am a newbie to gawk and I really don't know how to do this... I have a file with several columns of numbers and I want to make operations with some of the values...

cat file.dat | gawk -v NAME=2 '/AS/ {TIME=$4} $1==NAME {print TIME,($3*1)}'

The result of multiplying the field 3 by one yields zero, which is obviously wrong

I have tried with $3 = $3 * 1 and all possible combinations of brackets... why is it yielding zero??

thanks

this works for me:
awk --version
GNU Awk 3.1.4
echo "1 2 3" | awk '{ print "mult=" $3*$2 }'

the result is zero because somehow your system sees a string instead of a number. I admit i do not see why. (asuming you have TESTED that $3 realy is a number).

damn!!

Not, this gave me the same... but I have figured out the problem... the locales, man, I was employing my locales (Catalan) and all dots were substituted with commas and thus gawk could not do anything and the result of any operation was zero :eek:

So don't forget to do

LANG=C LC_ALL=C
export LANG LC_ALL

before you start gawking around