title: Count occurrences of character per line/field on Unix
body: <p>Given a file with data like this (ie stores.dat file)</p>
  
  <pre><code>sid|storeNo|latitude|longitude
  2tt|1|-28.0372000t0|153.42921670
  9|2t|-33tt.85t09t0000|15t1.03274200
  </code></pre>
  
  <p>What is the command that would return the number of occurrences of the 't' character per line?</p>
  
  <p>eg. would return:</p>
  
  <pre><code>count   lineNum
     4       1
     3       2
     6       3
  </code></pre>
  
  <hr>
  
  <p>Also, to do it by count of occurrences by field what is the command to return the following results? </p>
  
  <p>eg. input of column 2 and character 't'</p>
  
  <pre><code>count   lineNum
     1       1
     0       2
     1       3
  </code></pre>
  
  <p>eg. input of column 3 and character 't'</p>
  
  <pre><code>count   lineNum
     2       1
     1       2
     4       3
  </code></pre>