grep With Context: -A and -B

grep -A and -B for log investigation.

Flags

The context flags turn grep from a line-finder into a log-reader. Three flags handle almost every investigative case.

Examples

Three patterns recur across log investigations. Memorise these and most grep work becomes muscle memory.

Limit

grep slows down on multi-GB logs. ripgrep handles the same patterns faster, and centralised log search is the right tool above a certain volume.