Skip to main content

Posts

Showing posts with the label highlighting

tail f with highlighting

tail f with highlighting If you want to highlight something when doing �tail -f� you can use the following command: tail -f /var/log/logfile | perl -p -e s/(something)/33[7;1m$133[0m/g; or if your terminal supports colours, e.g. linux terminal, you can use this: tail -f /var/log/logfile | perl -p -e s/(something)/33[46;1m$133[0m/g; If you need to highlight multiple words you can use something like this: tail -f /var/log/logfile | perl -p -e s/ (something|something_else) /33[46;1m$133[0m/g; and if you want it to beep on a match use this: tail -f /var/log/logfile | perl -p -e s/(something)/33[46;1m$133[0m07/g; If you find that perl is too heavy for this you can use sed: tail -f /var/log/logfile | sed "s/(something)/x1b[46;1m1x1b[0m/g" Note, that in the last example you have to actually type �cntl-v cntl-[� in place of �^[� x1b character can also be used as the escape character. For the full list of control characters on Linux you can look at: man console_codes download  file  n...