title: How to grep number of unique occurrences
body: <p>I understand that <code>grep -c string</code> can be used to count the occurrences of a given string. What I would like to do is count the number of unique occurrences when only part of the string is known or remains constant. </p>
  
  <p>For Example, if I had a file (in this case a log) with several lines containing a constant string and a repeating variable like so:</p>
  
  <pre><code>string=value1
  string=value1
  string=value1
  string=value2
  string=value3
  string=value2
  </code></pre>
  
  <p>Than I would like to be able to identify the number of each unique set with an output similar to the following:  (ideally with a single grep/awk string)</p>
  
  <pre><code>value1 = 3 occurrences
  value2 = 2 occurrences
  value3 = 1 occurrences
  </code></pre>
  
  <p>Does anyone have a solution using grep or awk that might work? Thanks in advance!</p>