How to (e) grep XML for certain tag content?

wormat22

New Member
How can I (e)grep all content between a certain tag block?Assume input file below, I want to get as output all characters between the B-tags so:\[code\]<B><C>Test</C></B><B>Test2</B>\[/code\]I tried the following grep to search all XML files with the content between the \[code\]<B>\[/code\] and \[code\]</B>\[/code\] tags. \[code\]grep '<B>.*</B>' *.xml\[/code\]but it did not work.For the following input:\[code\]<A> <B> <C>Test</C> </B> <D> </D> <B> Test2 </B></A>\[/code\]Any ideas?
 
Back
Top