I am searching a pattern item_id>000111111</item_id> in an XML file.
More than one occurance are there for this patter in a single line.
I have tried
awk '/item_id/,/item_id/' tpnb1.txt>abc.txt
Full lines containg pattern are coming.
I need only list of 000111111.
A quick and dirty solution using perl:
perl -ne 'm,<asd>(.+)</asd>, and print "$1\n" ' file.xml
or sed
sed -ne 's,<asd>\(.*\)</asd>,\1,p' file.xml
But note that this won't work if the XML has more than one item_id tag on a line like
<item_id>000111111</item_id><item_id>000111111</item_id>
Then it gets tricky.