微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

有没有办法将这种模式与shell或sed相匹配?

我有一个包含以下输出文件
BP 0 test:
    case    id          Name            
    ======  ========  =================
         0        82  a_case-2-0-0      

BP 1 test:
    case    id          Name            
    ======  ========  =================
         0        86  a_case-2-1-0      

BP 2 test:
    case    id          Name            
    ======  ========  =================


BP 3 test:
    case    id          Name            
    ======  ========  =================
         0        93  a_case-2-3-0

所以,只有“BP 0,1,3”才有内容,所以我想要的是,是否有可能只进行’BP 0测试’,’BP 1测试’和’BP 3测试’,只想进入’ BP 2测试’因为没有测试用例.

谢谢你的帮助.

$awk -F'\n' -v RS='' -v ORS='\n\n' 'NF>3' input.txt
BP 0 test:
    case    id          Name
    ======  ========  =================
         0        82  a_case-2-0-0

BP 1 test:
    case    id          Name
    ======  ========  =================
         0        86  a_case-2-1-0

BP 3 test:
    case    id          Name
    ======  ========  =================
         0        93  a_case-2-3-0

原文地址:https://www.jb51.cc/bash/383367.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐