Harry Putnam <reader(_at_)newsguy(_dot_)com> writes:
I think I've done this before but can't find it in old .procmailrcs.
If I wanted to filter certain line in the body and re-write them back
to the message, but in the header...
1) extract something from body into a variable seen by procmail
2) Remove all subject headers
3) Insert new subject header with the VAR from 1 folded under it.
I'm guessing my post just sounded like a bunch of gobbledeegook and
hence the lack of responses to it.
I'd like to try again with the actual mail I want to filter (or at
least part of one).
here is the top of a typical message I want to work on.
From: portage(_at_)newsguy(_dot_)com
Subject: elog reader.local.lan
To: reader(_at_)reader(_dot_)local(_dot_)lan
Date: Sun, 28 Feb 2010 10:42:40 -0600
Message-Id:
<201002281642(_dot_)o1SGgemb004967(_at_)reader(_dot_)local(_dot_)lan>
elog messages for the following packages generated by process 19614 on host
reader.local.lan:
- dev-libs/nspr-4.8.3-r3
- dev-util/intltool-0.41.0
- media-libs/freetype-2.3.12
- dev-lang/perl-5.10.1
- sys-kernel/linux-headers-2.6.32
Messages generated for package dev-libs/nspr-4.8.3-r3 by process 19614 on
20100228-101510 CST:
[...]
------- ----8<----- ---=--- ----8<----- --------
The lines in the body beginning with dash (-) are the target. I want
to insert a copy of them into the `Subject:' field with indentation so
they are folded.
The section I'm concerned with always begins with a line beginning
with (-), and ends with a line beginning with `>>>'
So how can I take those lines and insert them into the Subject field
of the delivered mail?
Something like this approximation below... but how to make the script
create a value for $MATCH or some other variable
(I'm not asking for help with the script itself, but with how to
make its ouput become the value of a variable procmail can use)
:0
* ^From: portage@
{
:0 cbfw
| script_that_collects_those_lines
## Here a variable is set somehow containing those lines
MYVAR (now contains the lines in question, formatted with
indentation)
:0 fw
|formail -i "Subject: $MYVAR"
:0
mailbox
}
So the end result is a message with subject made up from those lines.
From: portage(_at_)newsguy(_dot_)com
Subject: elog: - dev-libs/nspr-4.8.3-r3
- dev-util/intltool-0.41.0
- media-libs/freetype-2.3.12
- dev-lang/perl-5.10.1
- sys-kernel/linux-headers-2.6.32
To: reader(_at_)reader(_dot_)local(_dot_)lan
Date: Sun, 28 Feb 2010 10:42:40 -0600
Message-Id:
<201002281642(_dot_)o1SGgemb004967(_at_)reader(_dot_)local(_dot_)lan>
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail