grep

user@user:~$ grep -A 4 -B 7 "aaa" bbb.txt

在 bbb.txt 尋找 aaa 字串。

-A NUM : Print NUM lines of trailing context after matching lines.
-B NUM : Print NUM lines of leading context before matching lines.
-C NUM : Print NUM lines of output context.
這個相當於 -C NUM => -A NUM -B NUM

posted @ 2017-03-13 16:18  wangchangruei  阅读(135)  评论(0)    收藏  举报