title: use grep to count the number of times a word got repeated in a file
body: <p>The problem is like this:</p>
  
  <p>For instance, I have a file "a.xml". Inside this file it is just one line as </p>
  
  <pre><code>&lt;queue&gt;&lt;item&gt;&lt;cause&gt;&lt;item&gt;
  </code></pre>
  
  <p>I want to find how many times <code>&lt;item&gt;</code> occurs, and in this case it is 2. </p>
  
  <p>However, if I run: </p>
  
  <pre><code>grep -c "&lt;item&gt;" a.xml 
  </code></pre>
  
  <p>It will only give me 1 because grep stops as soon as it matches the first <code>&lt;item&gt;</code>.</p>
  
  <p>So my problem is how do I use a simple shell/bash command that returns the number of times <code>&lt;item&gt;</code> occurs? </p>
  
  <p>It looks simple but I just cannot find a good way around. Any ideas?</p>