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