我想搜索每一行的单词FAILED,然后打印上面和下面的每行匹配线,以及匹配线。
输入:
id : 15
Status : SUCCESS
Message : no problem
id : 15
Status : FAILED
Message : connection errorgrep 'FAILED'的期望输出
id : 15
Status : FAILED
Message : connection error发布于 2009-07-02 05:29:00
使用-B、-A或-C选项
grep --help
...
-B, --before-context=NUM print NUM lines of leading context
-A, --after-context=NUM print NUM lines of trailing context
-C, --context=NUM print NUM lines of output context
-NUM same as --context=NUM
...https://stackoverflow.com/questions/1072643
复制相似问题