All pastes #102576 Raw Edit

Loki

public text v1 · immutable
#102576 ·published 2006-07-27 18:04 UTC
rendered paste body
#!/usr/bin/perl -w

use strict;
use warnings;

my (@rcfiles) = </home/steele/sa-exim-migration/procmails/*/.procmailrc>;
my ($patterns) = join '|', (':0fw: spamassassin.lock', '\* < 128000', '\| /usr/bin/spamc -d ha');
my ($inputfile);
my ($outputfile);

foreach (@rcfiles){
        $inputfile = shift(@rcfiles);
        open(IN, "$inputfile") or die "Error - couldn't open $inputfile";
        $outputfile = $inputfile . "\.tmp";
        open(OUT,">$outputfile") or die "Error - couldn't open $outputfile";

        while( <IN> ){
                chomp($_);
                if( $_ =~ m/($patterns)/ ){
                        print "Line matched!  Deleting it from the file...\n";
                } else {
                        print OUT "$_\n";
                }
        }
        close(IN);
        close(OUT);
        rename ($outputfile,$inputfile);
}