[olug] need some quick help with sed

Jay Hannah jay at jays.net
Fri Dec 18 15:39:57 UTC 2009


On Dec 18, 2009, at 9:09 AM, Obi-Wan wrote:
> This will remove all the XML tags from a line:
> 
> postID=`cat ./data.xml | sed -e 's/<[^>]*>//g'`

I doubt we wants to shove the whole file (minus XML tags) into postID.

But, in case he does, here's an equivalent Perl command (strip all tags):

   perl -pe 's/<.*?>//g' data.xml

(This solution is probably naive. CDATA tags, multi-line tags, etc.?)

j
Omaha Perl Mongers: http://omaha.pm.org





More information about the OLUG mailing list