Question:
Will awk perform decimal point calculaiton or not?
plz help
Sharif.S
Printable View
Question:
Will awk perform decimal point calculaiton or not?
plz help
Sharif.S
Why not?
Refer the following URL:
[url=http://www.grymoire.com/Unix/Awk.html]Awk - A Tutorial and Introduction - by Bruce Barnett[/url]
-------------------
suresh
then wat cud be the reason for this output:-
[U][B]shell[/B][/U]
awk 'BEGIN{sum=0;}
{sum=sum+(99999.99);
print sum;
}' filed
[B]Output[/B]
100000
200000
300000
400000
500000
600000
700000
800000
900000
1e+06
1.1e+06
1.2e+06
1.3e+06
1.4e+06
can someone pls look in to this..
Guys i have found the solution for the abv question..
Thanks!
Sharif.S
Whats the solution sharif?
why that occurred?
post it. we too will learn.
Hi SHerif,
As i saw u posted a very intersting query .After that you yourself found a solution for that also. That's great but if u found a solution please share with us.
Then we also come to know about the same problem's solution.
Regards
Nikhil Rattan
In awk there is settings parameter called OFMT which holds/defines the output format of numbers. by default its [B]"%.6g"[/B]. By increasing it we can achive desired results.
sorry guys yesterday i was with urgent task to complete, so cudn't able to post solution.
Thanks,
Sharif
Hi,
Sheri,
That was really i nice solution with complex query.
Thanks to post solution.
Regards
Nikhil
Hey Nikhil,
Just a change i want to mention. am [B]sharif[/B] not sheri!!!!!!
Cheers,
Sharif
oh oh
Yap i mistyped that
fine
cheers!!!!!
Nikhil Rattan
No Issues Nikhil..
Cheers
Sharif
hi,
Sorry Sharif,
I mistyped that . I will take care about that for future.
Regards
Nikhil Rattan