title: Why does AWK refuse to sum up floats
body: <p>I'm facing a rather strange problem with<code>awk</code> where I want to calculate the average of a column. This is the test input form my file:</p>
  <pre><code>1
  2
  0.4
  0.250
  0.225
  0.221
  0.220
  0.218
  </code></pre>
  <p>And this is the script I'm trying to run:</p>
  <pre><code>awk '{sum += $1} END {print sum; print sum / NR}' ~/Desktop/bar.txt
  </code></pre>
  <p>What I expect as output is:</p>
  <pre><code>&lt;calculated sum&gt;
  &lt;calculated average&gt;
  </code></pre>
  <p>But this is what I get invariably:</p>
  <pre><code>3
  0,375
  </code></pre>
  <p>I've checked the formatting and characters of the input file etc. but I can't get<code>awk</code> to sum up those pesky floats.</p>
  <p>Any ideas?</p>
  <p>I'm running <code>awk</code> version 20070501 in bash 3.2.48 on OS X 10.8.5.</p>
  <h3>Update</h3>
  <p>As @sudo_O correctly deduced, the problem is my locale. Replacing the <code>.</code> with a <code>,</code> in the file yields the correct results. That's obviously not the solution I'm looking for though so I need to do something with my locale which is currently set to:</p>
  <pre><code>$ locale
  LANG=&quot;de_CH.UTF-8&quot;
  LC_COLLATE=&quot;de_CH.UTF-8&quot;
  LC_CTYPE=&quot;de_CH.UTF-8&quot;
  LC_MESSAGES=&quot;de_CH.UTF-8&quot;
  LC_MONETARY=&quot;de_CH.UTF-8&quot;
  LC_NUMERIC=&quot;de_CH.UTF-8&quot;
  LC_TIME=&quot;de_CH.UTF-8&quot;
  LC_ALL=
  </code></pre>
  <p>I'd like to keep numeric, monetary and date locales I think. Which locale do I need to change (and how), to make <code>awk</code> work?</p>