title: awk count pattern matches and sum the numbers after them
body: <p>I have a file with the following pattern that repeats many times:</p>
  
  <pre><code>&lt;Content&gt;Un relax en el ritmo trepidante de New York   showReview(14443615, 'full');
  &lt;Date&gt;Mar 22, 2008
  &lt;Overall rating&gt;3
  &lt;No. Reader&gt;-1
  &lt;No. Helpful&gt;-1
  &lt;Overall&gt;5
  </code></pre>
  
  <p>So I'm trying to count the number of occurences of <code>&lt;Overall&gt;</code> <strong>without counting</strong> <code>&lt;Overall rating&gt;</code>. Then I want to sum the numbers that follow after each <code>&lt;Overall&gt;</code> tag. This is my code.</p>
  
  <pre><code> awk -F'&gt;' '$1=="&lt;Overall" BEGIN{}
      {
          count++
          sum+=$2
      }
      END{printf "%.2f\n", sum/count}' *filename*
  </code></pre>