Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Jul 2001 19:29:28 -0400
From:      parv <parv_@yahoo.com>
To:        f-q <freebsd-questions@freebsd.org>
Subject:   need suggestions to filter make logs
Message-ID:  <20010717192928.A38890@moo.holy.cow>

next in thread | raw e-mail | index | archive | help
hi,

following is the regex (in perl) that i have came up w/ so far to
filter large make logs, like (build|install)(world|kernel).

does anybody have suggestions for other "interesting" regexes?

-------  filter-log .perl  --------
#!/usr/bin/perl -w
use strict;

# line-wise buffering
$|=1;

while (<>)
{
  # print "status" & errors+warnings, but not compiler lines
  print if (m#[-=>]{3,}|\b(?:warning:|error|stop)#i && ! m#^cc.+#i);

  # print 'time' statistics
  print if m#(?:real|user|sys)\s+\d+m\d+\.\d{3}s#
}
----------------------------


i use it like this...

# cd /source/src && (make buildworld )>& /log/some/where &
#
# tail -f /log/some/where | filter-log


ideally i would have done this, tail included...

-------  filter-log .sh  --------
#!/bin/sh

if (test -f $1 -a -r $1)
then
  tail -f  | 
  egrep -i '\-\-\-|===|warning:|error|stop|real.*m.s' | 
  grep -v '^cc '
fi
----------------------------


...but due to buffering, 2d grep would result in no output; otherwise i
would have to sacrifice the 2d grep...

any suggestions?

-- 
 so, do you like word games or scrabble?
	 - parv

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010717192928.A38890>