For people like myself who have a 'very old' grep that doesn't include the --group-separator
option, the following seems to be an acceptable workaround.
Noticing that grep
(my version, 2.5.1) does produce a "small, default" separator between groups (--
), you can easily replace that string with a string of your choice:
tail -f rms.log -n 2000 | grep -B 10 -A 25 'Exception:' | sed 's/^--$/=================/'
This does replace the --
with ============
Obviously you can modify this to your liking. If you have the option of using --group-separator
(@sudo_O's answer) that is obviously preferable.
EDIT reading the comments below the question, I realize that when @starrify updated his comment (which I had not noticed before) his comment essentially pointed directly to this solution - so I feel I own him a tip of the hat...