On 6-Jul-2007, at 16:23, Jim Syler wrote:
I am a Procmail and UNIX novice. I have, with much labor, gotten
Procmail up and running and successfully forwarding email the way I
want it to (I'm not using Procmail for an LDA; I'm using it to,
hopefully, filter, modify and redirect email). Now I need some advice
on how to get the actual meat of what I want done working.
Specifically, I want to change certain bits of the body of my emails.
In particular, I want to change things to
<br><br>--<br><font color="gray" size="2">
Erm, well, first off, <p style="color: gray; font-size:80%"> ... </p>
would be a much better choice.
Posted By Calion to <a
href="http://homepage.mac.com/calion/blog/thoughts/2007/07/here-we-
go.html"> Genius/Idiot—Current Thoughts </a> at 7/06/2007
02:10:00 PM</font>
What is the best way to go about doing this?
Probably an external perl script, actually. the &mdash; problem
would be easily solved with sed, but multi-line captures and edits
can be tricky.
Now, if you can do womething like
s/<br><br>--<br>/<p style="color: gray; font-size:80%">/ with
confidence (that is, it always stats with two <br>'s and then -- and
then a <br>
and it ALWAYS ends with a date stamp you can anchor the </p> against,
then sed in the procmail should be fine:
:0
* tests
* go here
* to ensure right message
{
:0fwB
| sed 's/<br><br>--<br>/<p style="color: gray; font-size:80%">/'
:0fwB
| sed 's/\d:\d\d:\d\d .M/&</p>/'
}
Should get you started. Not tested or anything, and it will blow up
on long messages that exceed LINEBUF, so check for that in the tests.
As I understand it, there is no way to modify the body without
forking an external process of some sort.
--
"Why do you wear that stupid bunny suit?"
"Why are you wearing that stupid man suit?"
____________________________________________________________
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