The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Special Forums > UNIX and Linux Applications
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 07-09-2008
spirtle spirtle is offline
Registered User
  
 

Join Date: Jun 2008
Location: Scotland
Posts: 150
A quick and dirty solution using perl:
Code:
perl -ne 'm,<asd>(.+)</asd>, and print "$1\n" ' file.xml
or sed
Code:
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.