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
?
pipe it further through, for instance
sed -e 's,.*<title>\([^<]*\)</title>.*,\1,g'
sed
to parse XML (or HTML) isn't generally a good idea. It should be done only when the input is well known and doesn't vary unexpectedly. For anything slurped automatically from the internet a proper parser should be used.
xmlstarlet
may be useful utility.grep
is no bash builtin.