On Jul 7, 2007, at 12:37 AM, LuKreme wrote:
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.
Thanks. I knew the <font> tag was outdated, but my html is rusty, so I
just used what old Blogger used to do.
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>/'
}
Why the single quotes around the sed commands? I don't see anything
about that in the sed manpage.
The first part works great. The second plays Hob somehow; I'm not
entirely sure what it's doing, but I end up with a whole bunch of
header lines in the body. I thought 'B' meant that the header wouldn't
be evaluated?
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.
So this will fail on messages larger than 2048 characters? Is that
right? This is of limited usefulness if that's the case.
As I understand it, there is no way to modify the body without
forking an external process of some sort.
Well, as long as I can avoid perl...
Thanks heaps!
Jim
--
Ron Paul President 2008!
It is time for President Paul!
The only candidate who defends liberty and the
Constitution!
http://ronpaul2008.com
Visit Jim's Web Portal: http://homepage.mac.com/calion/
PGP.sig
Description: This is a digitally signed message part
____________________________________________________________
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