title: Number formatting with awk
body: <p>I have several files with many columns and thousands of lines. Most entries are float with too high precision and some are given in scientific notation. I am trying to use awk to reformat all the numbers but I am not very familiar with awk. I have tried the following</p>
  
  <pre><code>cat bs04_diff_all_e.csv | awk -v OFS="," -v OFMT="%.2f" -F"," 'NR == 45 {printf $1,$2,$3,$4,$11,$12,$13,$14,$15,$16,$17,$18,$19}' 
  </code></pre>
  
  <p>Which outputs </p>
  
  <pre><code>648376.819998
  </code></pre>
  
  <p>only. i.e. the first post in the line, unformatted.</p>
  
  <pre><code>cat bs04_diff_all_e.csv | awk -v OFS="," -v OFMT="%.2f" -F"," 'NR == 45 {print $1,$2,$3,$4,$11,$12,$13,$14,$15,$16,$17,$18,$19}' 
  </code></pre>
  
  <p>outputs </p>
  
  <pre><code>648376.819998,7537575.31999,1692.0,34.99202,0.30931,0.0054,0.07764,0.01284,0.00849,0.04081,0.0403,0.00946,-9e-05
  </code></pre>
  
  <p>So there I get the columns but the formatting is still not working. I have looked around for a solution and cannot see why this doesn't work but then as I stated earlier, I am not familiar with awk. What am I doing wrong? Do I really have to specify the number format for all 44 columns individually?</p>