Date: Fri, 20 Jun 2003 09:49:28 -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: <20030620094405.P12980@wonkity.com> In-Reply-To: <20030620153457.GA2304@happy-idiot-talk.infracaninophile.co.uk> References: <20030620130049.63710.qmail@web10002.mail.yahoo.com> <20030620134326.GA615@happy-idiot-talk.infracaninophile.co.uk> <20030620153457.GA2304@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:
> That's not quite the same thing. You're just taking out the lines
> that match /last message repeated \d+ times/ (and constructing a
> backreference to \d+ that you never use):
>
> Jun 20 16:26:02 example /kernel: ipfw: 800 Deny TCP 12.34.56.78:1234 21.43.65.87:4321 out via de0
> Jun 20 16:26:27 example last message repeated 2 times
>
> becomes:
>
> Jun 20 16:26:02 example /kernel: ipfw: 800 Deny TCP 12.34.56.78:1234 21.43.65.87:4321 out via de0
>
> whereas I'm replacing that line with the correct number of repeats of
> the original line,
Ah, I didn't see that you were expanding those lines. You're right
about the useless backreference. And then right after posting, I
realized that it could be even smaller and--arguably--clearer:
#!/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?20030620094405.P12980>
