Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Shell, bash : grep 多行的 html 标签
如何在 input.txt 中从 tr grep 到 /td?
<tr> <td>Answer</td>
我的代码是
grep -o "<tr>.*</td>" input.txt > output.txt
但它什么也没返回..
您最好使用 HTML 解析器,但对于简单的需求,基于范围的awk解决方案可能会起作用
awk '/<tr>/,/<\/td\>/' input.txt