#!/usr/local/bin/perl -w # # egroups # # Strip the ads from egroup messages. # # The .procmailrc entry for dealing with this is: # :0 fbw # * ^To:.*@egroups.com # | /usr/local/bin/egroups # use strict; use vars qw($Version); $Version = 'egroups v0.02 regan@ao.com'; ### ### Main program ### my($count, $pending, $state); $state = 0; while (<>) { if (/eGroups Sponsor/ || /begin egp html banner/ || /Groups Sponsor/) { $state = 1; } elsif ($state == 1 && (/-------------------------------/ || /end egp html banner/)) { $state = 2; } elsif ($state == 0 && /_________________________________________________________________________/) { $state = 3; $count = 0; $pending = ""; } if ($state == 0) { # print "$state $_"; print $_; } elsif ($state == 3) { $pending .= $_; if ($count++ > 15) { print $pending; $state = 0; $pending = ""; } } if ($state == 2) { $state = 0; } } exit 0;