zoukankan      html  css  js  c++  java
  • grep 关键字显示上下行

    场景01

    • 查询的关键字"XXX process began"
    • 日志的名称 test_xxx.log
    • 显示关键字下方20行
      在日志test_xxx.log里根据关键字“XXX process began” 显示关键字的行和关键字之后的20行

    命令

    tail -10000 test_xxx.log |grep -A20  'XXX process began'
    

    场景02

    • 查询的关键字"XXX process began"
    • 日志的名称 test_xxx.log

    在日志test_xxx.log里根据关键字“XXX process began” 显示关键字的行和关键字之后的20行

    命令

    tail -10000 test_xxx.log |grep -B20  'XXX process began'
    

    场景03

    • 查询的关键字"XXX process began"
    • 日志的名称 test_xxx.log

    在日志test_xxx.log里根据关键字“XXX process began” 显示关键字的行和关键字之前的20行以及之后的20行

    命令

    tail -10000 test_xxx.log |grep -C20  'XXX process began'
    
    本人水平有限,还在不断学习中 难免有很多错误或者遗漏,望见谅
  • 相关阅读:
    简单对拍
    搜索感想
    L1434滑雪
    记忆化搜索
    L3956棋盘
    USACO 数字三角形
    枚举顺序
    蓝桥计算
    用户态和内核态IO过程
    Mybatis的结果集中的Do要不要有setter
  • 原文地址:https://www.cnblogs.com/faberbeta/p/15003097.html
Copyright © 2011-2022 走看看