I have a unusual problem which I have no idea how to solve.
I have a awk script to calculate sum of different elements but at the end i have a very large number as result ( and that is normal) but my concern is how the number is displayed 1.84745e+09
.
Any idea to get the "correct" form like i mean 182739293747493274
for example
for example this is the awk code i'm using
awk -F, 'FNR==1 {header=$0; next} {a[$1]+=$6+$14} END {for (i in a) {print i, a[i]; tot+=a[i]} print "TOTAL", tot}' CAS01.txt CAS02.txt CAS03.txt
and here the output i have
20140201 -5.04108e+08 20140202 -5.74709e+08 20140228 -7.68633e+08 TOTAL -1.84745e+09
My concern is that i want the output number to be fully displayed not in exposant format
GNU Awk has the extension
-M
which provides for arbitrary-precision integer arithmetic.If you can't use GNU Awk, and your Awk does not have a similar extension, you will have to switch to a tool which does (
bc
comes to mind, or try Perl; there is a toola2p
in the Perl distribution to translate Awk scripts to Perl code).