免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2537 | 回复: 2
打印 上一主题 下一主题

[文本处理] [正则表达示]跨行判断问题? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 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可否做到?

论坛徽章:
1
辰龙
日期:2014-05-22 11:38:58
2 [报告]
发表于 2012-09-29 11:30 |只看该作者
  1. sed '/^<table/{:a;$b;N;/<\/table>$/!ba;/<td class="line-height24 size14">.\+<\/td>/!d}' urfile
复制代码

论坛徽章:
0
3 [报告]
发表于 2012-09-29 11:54 |只看该作者
winway1988 发表于 2012-09-29 11:30

多谢,请问一下$b在这里是什么意思?是最后跳转?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP