title: count number of xml element from linux shell
body: <p>My xml looks something like this :</p>
  
  <pre><code>&lt;elements&gt;
  &lt;elem&gt;
  ....bunch of other elements
  &lt;/elem&gt;
  &lt;/elements&gt;
  </code></pre>
  
  <p>Is there a way to count the number of occurances of <code>elem</code> tag in some xml file trough linux shell? like with perl/python or anything that might work as one liner?</p>
  
  <p>I might try something like <code>grep -c "elem" myfile.xml</code> and the number I get divide it by <code>2</code> and get the number, is there something similar but one liner?</p>
  
  <p><strong>EDIT :</strong></p>
  
  <p>I'm looking for alternative grep solution</p>