Monday, October 5, 2015

Grep lines arround

-B Lines before
-A Lines after

$ grep -B 3 -A 2 foo README.txt
 
The same number of lines before and after you can use -C num.
$ grep -C 3 foo README.txt

No comments:

Blog Archive