IPFW Log question
Warren Block
wblock at wonkity.com
Fri Jun 20 08:49:31 PDT 2003
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
More information about the freebsd-questions
mailing list