Hi,
I have the following code in which i am trying to find ceil of 10th & 11th fields. For finding ceil i have a function in the awk statement. When i test it for some values say on command line it gives correct response(say $10=0 & $11=750). But when the same value occurs in a file having more 3 millions records(it is just an example & behaviour is abrupt for some cases), the value gets impacted. Can you please suggest in case some modifications are required.
function pdsnrater()
{
awk -F"|" '
function ceil(val) { return (val == int(val)) ? val : int(val)+1}
{
if ($5 == "MB")
printf("%s,%s,%s,%s,%s,%d,%s,%s,%s,%s,%s,%s,%d,%s,%s,%s\n",$1,$2,$3,$4,$6,ceil(($10+$11)/1024/1024),$8,$9,$10,$11,$12,$13,$14,$15,$16,$5)
else
printf("%s,%s,%s,%s,%s,%d,%s,%s,%s,%s,%s,%s,%d,%s,%s,%s\n", $1,$2,$3,$4,$6,ceil(($10+$11)/1024/10),$8,$9,$10,$11,$12,$13,$14,$15,$16,$5)
} ' FS="|" OFS="|" $1 > $1.tmp
mv $1.tmp $1
}