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

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758200864, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/tools/scripts/personal/highlight_pl(58): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78