njrsog
Last Updated: February 25, 2016
·
364
· andy_kif

Count items in a long XML file

Want to count items within an XML structure like the one below ?

<root>
    <item_tag>....</item_tag>
    <!--maybe thousands of items here-->
</root>

Here's a simple line command to do that

cd directory
grep "<item_tag>" filename.xml | wc -l

This will output the exact number of items within your XML structure