Hello,
One of my uses of procmail is to strip out unwanted headers and adjust the
remaining headers in the order I choose. To do this, I sometimes replace one
header with another so it matches in the reordering commands, and it also helps
keep my headers consistent. The Date is ALWAYS at the top for me (unless it's a
header I haven't trashed or re-ordered). :-)
I'm curious to know if anyone knows how to use wildcards to help me do this so
I won't need line-for-line commands. Because regular expressions may not work
(or may not work the same as within a procmail recipe) in a piped formail
command, I was hoping someone could advise. See below:
Here's an example, I change Sender to X-Sender (and the dots represent many
lines before and after that do similar functions for other headers - but I kept
them out to keep this short) :
:0 Hhf
....
| formail -R Sender: X-Sender: \
....
Now I can match on it:
:0
* ()\/^X-Sender: +\/.*
{ XID = $MATCH }
Next, I place the X-Sender header before or after other headers like this (and
here the dots represent things like the subject, date, cc, etc):
:0 fh w
| $FORMAIL \
....
${XID:+ -I"X-Sender: $XID"} \
....
So, for this example, if someone uses X-X-Sender, I need another line like this
in the first part of this:
| formail -R X-X-Sender: X-Sender: \
This works fine, but I need to constantly tweak it when a new variety arrives
that doesn't exist in my recipes. Is there a way to just watch for the word
sender (case insensitive) ignoring characters before and after? Thus, this
would change anything with sender in it to become X-Sender? Something like
this, where .* is the wildcard:
| formail -R .*sender.*: X-Sender: \
The above doesn't work which is why I'm writing.
Where this becomes really valuable is for those of us adding extra, non-uniform
headers (like PGP information) to headers. I just want to display them all as
the same thing even if everyone names the header something different (pending
special text, of course, like PGP-Key, or GNUPGP, or X-PGP-Key - you get the
point).
Thanks for any assistance!
ED
---------------------------------
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail