Grep an XML file for certain patterns

diceman2037

New Member
I have a large XML file that has tens of thousands of the same elements:\[code\]<rootElem> <fizz buzz="true">234</fizz> <fizz buzz="false">384</fizz> <fizz buzz="true"></fizz> <fizz buzz="true">39494</fizz> <fizz/></rootElem>\[/code\]I'd like to run a \[code\]grep\[/code\] that prints out any \[code\]<fizz>\[/code\] elements that do not contain text/body data (the numbers in between the opening & closing tags). In the example above, the \[code\]grep\[/code\] would produce 2 lines for the 3rd and 5th \[code\]<fizz>\[/code\] elements that do not contain the numeric data. The file name is \[code\]fizzes_20.xml\[/code\]. I tried running the following but to no avail:
  • \[code\]grep fizzes_20.xml "></>"\[/code\]
  • \[code\]grep fizzes_20.xml "/>"\[/code\]
Any ideas? Thanks in advance!
 
Back
Top