Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get text inside xml tag using grep [duplicate]

It's Friday afternoon, and my brain has frozen!

grep -E -m 1 -o "<title>(.*)</title>" myfile.rss

returns

<title>Some title</title>

How do I just get Some title?

like image 409
tdc Avatar asked Nov 25 '11 15:11

tdc


1 Answers

pipe it further through, for instance

sed -e 's,.*<title>\([^<]*\)</title>.*,\1,g'
like image 102
Michael Krelin - hacker Avatar answered Nov 18 '22 03:11

Michael Krelin - hacker