I have an xml file called test.xml.
<deathList>
<victimGroupA>
<person1>
<name>The Pope</name>
<email>pope@vatican.gob.va</email>
<is_satan>0</is_satan>
</person1>
<person2>
<name>George Bush</name>
<email>father@nwo.com</email>
<is_satan>1</is_satan>
</person2>
<person3>
<name>George Bush Jr</name>
<email>son@nwo.com</email>
<is_satan>0</is_satan>
</person3>
</victimGroupA>
<victimGroupB>
<person1>
<name>bob</name>
<email>bob@bobby.com</email>
<is_satan>0</is_satan>
</person1>
<person2>
<name>mike</name>
<email>mike@michael.com</email>
<is_satan>0</is_satan>
</person2>
</victimGroupB>
<victimGroupC>
<person1>
<name>kenny</name>
<email>kenny@youkilledkenny.com</email>
<is_satan>0</is_satan>
</person1>
</victimGroupC>
</deathList>
I want to write a bashrc script that will try to echo the following:
victimGroupA
person1
person2
person3
victimGroupB
person1
person2
victimGroupC
person1
Basically it should detect all victimGroup* and print out all the next sublevel categories of it. What's the easiest way of doing this? I need it compatible with centos and ubuntu.