Ravi Sir's Cards › AWS
grep in 4 steps
This revision card explains grep in 4 steps. It starts from the need that ignore case, line numbers. It describes search a folder. The how-to section notes two patterns. An example on the card is context around a hit.
Read card text
What this card says
Why do we need it?
Ignore case, line numbers.
grep -in error app.log
What is it?
Search a folder.
grep -rn TODO /srv/app
How to do it
Two patterns.
grep -E "OOM|panic" log
Example
Context around a hit.
grep -B2 -A3 ERROR log