title: Use Grep (or any other cmd line tool) to count Lines that contain different pattern
body: <p>I am experimenting with OpenMP, and I am just trying to write a small shell script to count of the number of lines that each thread outputs. And simply spit out each count.
  I started getting into it, and starting having to a write a for loop with either a hard coded or parameterized upper bound, and grep -c REG_EX, I also tried to use sed to clean up the extra output first to make greps job easier, but it is not working like I would like</p>
  
  <pre><code>EXAMPLE PROGRAM OUT(SCRIPT INPUT)
  
  Output to STDOUT (I can obviously pipe into sort first):
  Thread 0: EXTRA OUTPUT
  Thread 0: EXTRA OUTPUT
  Thread 2: EXTRA OUTPUT
  Thread 3: EXTRA OUTPUT
  Thread 0: EXTRA OUTPUT
  Thread 1: EXTRA OUTPUT
  .
  .
  .
  </code></pre>
  
  <p>ETC</p>
  
  <p>All I need is:</p>
  
  <pre><code>Thread 0: #repeats
  Thread 1: #repeats
  .
  .
  .
  Thread n: #repeats
  </code></pre>
  
  <p>Thanks in advance</p>