Convert exponential value to decimal

Hi,

Here is my script to read a file into array:
awk -F '[ \t$]+' '
# load first file into array indexed by fields 1 and 2
NR == FNR {
file1nr = FNR
for (i=3; i<NF; i++) {
file1[$1,$2,i] = $i
}

I have this value in file -1191190.11328125, but my script reads it as -1191190.00000
I want to read it as -1191190.11328.

I tried to add a line

$i = sprintf ("%.5d" $i)

But this yields -1191190.00000

Please help.

I tried
I want to read it upto 5 decimal places.

Please help.

Hi.

It's a floating point number.

try %.5f instead of %.5d

I also tried %.f and it didnot work.

Thanks.

this

$i = sprintf ("%.5f", $i)

didn't work?

Yes, thats right. It does display 5 decimal places after, but for some reason, it replaces it with zeros.

echo "-1191190.11328125" | awk '{$0 = sprintf ("%.5f", $0) ;print}' 
yields me 

-1191190.11328

You might me doing wrong somewhere else.