Search notes:

Script: highlight.pl

highlight.pl is a perl script that reads from stdin and writes the necessary ANSI escape sequences to print ERROR in red and WARNING in yellow.
#!/usr/bin/perl
use warnings;
use strict;

my $red     = chr(27) . '[1;31m';
my $yellow  = chr(27) . '[1;33m';
my $nocolor = chr(27) . '[0m';

while (my $line = <>) {

  $line =~ s/ERROR/${red}$&${nocolor}/g;
  $line =~ s/WARNING/${yellow}$&${nocolor}/g;
  print $line;

}
Github repository scripts-and-utilities, path: /highlight.pl
This script might especially be useful together with tail -f logFile

See also

Scripts

Index