Chinaunix
标题:
[正则表达示]跨行判断问题?
[打印本页]
作者:
peterdocter
时间:
2012-09-29 10:24
标题:
[正则表达示]跨行判断问题?
<table width="96%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="30" class="sbt">test</td>
</tr>
<tr>
<td class="line-height24 size14"></td>
</tr>
</table>
<table width="96%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="30" class="sbt">test</td>
</tr>
<tr>
<td class="line-height24 size14">12345</td>
</tr>
</table>
判断<table ...>到</table>结束,查看<td class="line-height24 size14">(是否为空)</td>
如果为空就把<table ...>到</table>结束全部删除!
请这条正则表达示如何写? sed可否做到?
作者:
winway1988
时间:
2012-09-29 11:30
sed '/^<table/{:a;$b;N;/<\/table>$/!ba;/<td class="line-height24 size14">.\+<\/td>/!d}' urfile
复制代码
作者:
peterdocter
时间:
2012-09-29 11:54
winway1988 发表于 2012-09-29 11:30
多谢,请问一下$b在这里是什么意思?是最后跳转?
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2