title: How to sum all numbers in the form of scientific notation in bash
body: <p>I have a data file like this</p>
  <pre><code>  1.59949146E+01  1.59949146E+01  1.59949146E+01  1.59949146E+01  1.59949146E+01
    1.59949146E+01  1.59949146E+01  1.59949146E+01  1.59949146E+01  1.59949146E+01
    1.59949146E+01  1.59949146E+01  2.39850450E+01  2.39850450E+01  2.39850450E+01
    2.39850450E+01  2.39850450E+01  2.39850450E+01  2.39850450E+01  2.39850450E+01
    2.39850450E+01  2.39850450E+01  2.39850450E+01  2.39850450E+01
  </code></pre>
  <p>To sum all the numbers, I use the following code</p>
  <pre><code>awk '{ for(i=1;i&lt;=NF;i++){ print $i}}' number.txt |awk '{printf (&quot;%f &quot;, $0)}' |awk '{ for(i=1;i&lt;=NF;i++){ print $i}}'|paste -sd+  | bc
  </code></pre>
  <p>First, it changes all raws to a single column</p>
  <pre><code>awk '{ for(i=1;i&lt;=NF;i++){ print $i}}' number.txt 
  
  1.59949146E+01
  1.59949146E+01
  1.59949146E+01
  1.59949146E+01
  1.59949146E+01
  1.59949146E+01
  1.59949146E+01
  1.59949146E+01
  1.59949146E+01
  1.59949146E+01
  1.59949146E+01
  1.59949146E+01
  2.39850450E+01
  2.39850450E+01
  2.39850450E+01
  2.39850450E+01
  2.39850450E+01
  2.39850450E+01
  2.39850450E+01
  2.39850450E+01
  2.39850450E+01
  2.39850450E+01
  2.39850450E+01
  2.39850450E+01
  </code></pre>
  <p>Using <code>awk '{printf (&quot;%f &quot;, $0)}'</code> I will have the following output</p>
  <pre><code>15.994915 15.994915 15.994915 15.994915 15.994915 15.994915 15.994915 15.994915 15.994915 15.994915 15.994915 15.994915 23.985045 23.985045 23.985045 23.985045 23.985045 23.985045 23.985045 23.985045 23.985045 23.985045 23.985045 23.985045
  </code></pre>
  <p>Again I need to use <code>awk '{ for(i=1;i&lt;=NF;i++){ print $i}}'</code> to convert raws to a column and then using <code>paste -sd+  | bc</code> I can have the answer</p>
  <pre><code>479.759520
  </code></pre>
  <p>Although it works I'm looking for a better way to reduce the steps.</p>