Date: Fri, 20 Jun 2003 08:21:52 -0600 (MDT) From: Warren Block <wblock@wonkity.com> To: Matthew Seaman <m.seaman@infracaninophile.co.uk> Cc: FreeBSD Questions <freebsd-questions@freebsd.org> Subject: Re: IPFW Log question Message-ID: <20030620081951.G12793@wonkity.com> In-Reply-To: <20030620134326.GA615@happy-idiot-talk.infracaninophile.co.uk> References: <20030620130049.63710.qmail@web10002.mail.yahoo.com> <20030620134326.GA615@happy-idiot-talk.infracaninophile.co.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 20 Jun 2003, Matthew Seaman wrote: > > Or if anyone has a perl script that tosses out the odd > > lines and just keeps the full lines and is willing to > > share it, that would work too. Otherwise, I am going > > to have to get better at perl in a big way. > > #!/usr/bin/perl -w > > $prevline = ""; > > while (<>) { > if (m/last message repeated (\d+) times/) { > for ( 1 .. $1 ) { > print $prevline; > } > } else { > print $_; > $prevline = $_; > } > } If I read that right, this would also work: #!/usr/bin/perl -w while (<>) { print $_ unless $_ =~ /last message repeated (\d+) times/; } -Warren Block * Rapid City, South Dakota USA
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030620081951.G12793>