[英]How to grep for multiple non-greedy matches in HTML text?
我的电话很长:
<div class="interesting">This is interesting1</div><div class="not interesting">Some text</div><div class="interesting">This is interesting2</div><div class="not interesting">Some more text</div>
如何提取以下内容:
This is interesting1
This is interesting2
从上面的文本使用grep? 有什么建议么?
cat temp | grep -o "<div class=\"interesting\">.*?</div>"
似乎没有给出任何东西。
cat temp | grep -P -o "<div class=\"interesting\">(.*?)</div>"
括号与该html标记内的item匹配。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.