#!/usr/local/bin/perl -w ## author: parv(at)pair(dot)com ## date: jan 06 2002 ## ## license: free to use as you please w/ proper credit given ## ## name: filtermklog.perl ## ## purpose: due to shell buffering, make output doesn't come up fast ## enough from, say, "tail -f log | egrep "..." | egrep -v "...". so use perl ## to show output as soon as possible. ## ## usage: ## cat | filtermklog.perl # # note that i insert " ## ## time: `date`" string in the log files. # see "cleanbw" script use strict; # line-wise buffering $|=1; while (<>) { # skip messages about things being compiled or cleaned next if m{ ^(?: cc | c\+\+ | rm | mkdep | echo) }ix ; # print "status" & errors+warnings # print if m{ [-=>]{3,} | \b(?: warning: | error | stop) | ^ \Q## ##\E }ix; # print 'time' statistics; e.g. "time make buildworld" #print if m#(?:(?:real|user|sys)\s+\d+m\d+\.\d{3}s)# }