SyntaxFix
Write A Post
Hire A Developer
Questions
You can use the -B and -A to print lines before and after the match.
-B
-A
grep -i -B 10 'error' data
Will print the 10 lines before the match, including the matching line itself.