How to use tail -f with grep to show surrounding lines
grep has extra options to define how many lines before and after the result:
-A
(after)-B
(before)-C
(context [before + after])
So in your case you need -A
:
YOUR_COMMAND |grep -A NUMBER YOURDOMAIN
the above command prints NUMBER
of lines after YOURDOMAIN
in file.
Try passing number of context lines to grep.
| grep -C 5
will print 5 lines before and after the match.