Hi All,
I have a file with long list of numbers. This file contains only one column. These numbers are very large. I am using following command:
cat myfile.txt | awk '{ sum+=$1} END {print sum}'
The output is coming in scientific notation. How do I get the result in proper format?
Thanks
Angshuman
millan
2
can u show the contents of the input file.
RudiC
3
... whatever is the "proper format"...
For a non-scientific notation use printf and the %f conversion specifier, or set the OFMT variable accordingly.
Hi,
I have attached the file. For this file, when I run the command, I get the result as
cat myfile.txt | awk '{ sum+=$1} END {print sum}'
5.69169e+06
Scott
5
As said, use printf not print.