title: reading data from a file using bash and getting sum for some columns with awk
body: <p>Lets say I want to collect some statistics over a .txt file that looks like this:</p>
  
  <pre><code>misses 15
  hit 18
  misses 20
  hit 31
  </code></pre>
  
  <p>I wrote a bash script that just prints every line:</p>
  
  <pre><code>#!/bin/bash 
  while read line           
  do           
      echo $line 
  done &lt;t.txt 
  </code></pre>
  
  <p>What I want now is this: the example is in pseudocode:</p>
  
  <pre><code>read every line
     if first column is miss add the number to total misses
     if hits add the number to total hits
  
  print total hits, and total misses in a file
  </code></pre>
  
  <p>I have searched and this can be done with awk. 
  Can you help to do this with awk?</p>