:::: MENU ::::
Monthly Archives: February 2014

Grep with context

Small thing but extremely useful. Getting context with grep.

-C – Print num lines of leading and trailing context surrounding each match. The default is 2 and is equivalent to -A 2 -B 2. Note: no whitespace may be given between the option and its argument.

grep -C 5 file.txt