Hello,
How do I do the following without running my external command twice?
Basically what I'm doing is comparing the incoming mail with a list of
lists that I'm on, and if I get a match, I save it to a file with the
same name that I matched on. It took quite a bit of experimentation
to get this to work, but I'd like to run my external command
(mygrep.plx) only once, for efficiency.
Thanks.
LIST=`formail -x Subject: -x To: -x Cc: -x Sender: -x From: |
$HOME/bin/mygrep.plx`
:0:
* ? (formail -x Subject: -x To: -x Cc: -x Sender: -x From: | *
$HOME/bin/mygrep.plx)
Lists/$LIST
mygrep.plx looks like this -
#!/usr/bin/perl
my $lists = "/home/bringman/.procmail/lists";
open (IN, $lists) or die ("damn : $!");
my @file = <IN>;
close (<IN>);
while (<STDIN>) {
foreach $line (@file) {
chomp ($line) ;
if ($_ =~ /$line/i) {
print (lc("$line\n"));
exit 0;
}
}
}
exit 1;
--
Rob Bringman
The views expressed are their own and do
not necessarily reflect those of the author.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail