Sometimes I want to keep tailing a log and look for a term – for example if you are an e-commerce platform then you may like to keep a running tail somewhere while keeping en eye on “checkout” page.
Following code snippet will highlight the term:
tail -f /var/log/apache2/access.log | perl -p -e 's/(checkout)/\033[46;1m$1\033[0m/g;'
You can highlight two such terms as well:
tail -f /var/log/apache2/access.log | perl -p -e 's/(checkout|another)/\033[46;1m$1\033[0m/g;'
Any perl regex should work for the highlighting, if your terminal supports it.








