title: obtain averages of field 2 after grouping by field 1 with awk
body: <p>I have a file with two fields containing numbers that I have sorted numerically based on field 1. The numbers in field  1 range from 1 to 200000 and the numbers in field 2 between 0 and 1. I want to obtain averages for both field 1 and field 2 in batches (based on rows).</p>
  
  <p>Here is example input output when specifying batches of 4 rows: </p>
  
  <pre><code>1 0.12
  1 0.34
  2 0.45
  2 0.40
  50 0.60
  301 0.12
  899 0.13
  1003 0.14
  1300 0.56
  1699 0.43
  2100 0.25
  2500 0.56
  </code></pre>
  
  <p>The output would be:</p>
  
  <pre><code>1.5 0.327
  563.25  0.247
  1899.75 0.45
  </code></pre>