-2

I created the following awk cli in order to sum the first column in the file

example of the file.txt

0
15.5
15.5
15.5
15.2
14.9
14.9
15.2
15.3
15.4
15.5
15.5
15.6
15.6
15.7
15.8
15.8
15.8
15.8
15.8
15.8
.
.
.

but awk gives the number --> 3.70747e+07 , that isn't readable

awk  '{sum+=$1;} END{print sum;}'  file.txt
3.70747e+07

is it possible to change the awk syntax in order to get readable number as 370747.......

Judy
  • 1,595
  • 6
  • 19
  • 41

1 Answers1

1

Replace print with printf like:

awk '{sum+=$1;} END{printf("%f\n",sum);}' file.txt
UlfR
  • 4,175
  • 29
  • 45