Skip to content

Latest commit

 

History

History
29 lines (21 loc) · 358 Bytes

File metadata and controls

29 lines (21 loc) · 358 Bytes

grep

After

# grep after 3 lines
grep "error" logfile.txt -A 3

Before

# grep before 5 lines 
grep "pattern" -B 5 file.txt

Context

# Search for "critical" and show 2 lines before/after
grep "critical" app.log -C 2

Combine sample

# grep 
kubectl logs pod-name | grep "Exception" -A 10 -B 5