Re: Macro -> procmail recipe
On 04Jun2006 03:16, George <d1945@xxxxxxxxxxxxx> wrote:
| On Sat, Jun 03, 2006 at 07:26:00PM -0400, Dave Waxman wrote:
| > I find myself ignoring the same threads in mailings lists constantly.
[...]
| # the subject line
| my $boringthread;
|
| while (<>) {
| if ( /^\s*Subject:\s*(.*)/ ) {
| $boringthread = $1;
| }
| }
|
| open (FILE, ">>$procmailrc") or die "Flaming death! $!\n";
| print FILE "$comment $date";
| print FILE ":0\n";
| print FILE "* ^Subject: $boringthread\n";
| print FILE "/dev/null\n\n";
Wouldn't it be better to be more picky? Your script will pull _every_
line in the message that even loosely resembles a Subject: line.
How about:
while (<>) {
chomp;
exit 0 if ! length; # end of headers
# presumably no subject line at all
if (/^subject:\s+/i) {
... append to .procmailrc ...
exit(0);
}
}
Faster on big messages, since it only reads the headers.
Guarrenteed to only add one recipe to the procmailrc.
Cheers,
--
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/
Criminals (especially tyrants) prefer unarmed victims.
- robertsw@xxxxxxxx (Wallace Roberts)