grep Exception but exclude specific Exception

后端 未结 2 1097
眼角桃花
眼角桃花 2021-01-13 08:05

I am currently matching for \"Exception\" from a file, and output 10 lines before and after using:

grep -C 10 \"[.*Exception\"

2条回答
  •  不知归路
    2021-01-13 08:49

    If your positive match pattern Exception is a word i.e not preceded/followed by other alphabets then you can use word-boundary.

    $ grep -C 10 '\\|\'
    

提交回复
热议问题