<分区>
今天是星期五下午,我的大脑已经卡住了!
grep -E -m 1 -o "<title>(.*)</title>" myfile.rss
返回
<title>Some title</title>
我怎样才能得到 Some title
?
<分区>
今天是星期五下午,我的大脑已经卡住了!
grep -E -m 1 -o "<title>(.*)</title>" myfile.rss
返回
<title>Some title</title>
我怎样才能得到 Some title
?
最佳答案
例如,进一步通过管道
sed -e 's,.*<title>\([^<]*\)</title>.*,\1,g'
关于regex - 使用 grep 获取 xml 标签内的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8270922/