On Wed, Nov 03, 2004 at 08:53:34AM +0000, Chris Green wrote:
This is (probably) only of interest to anyone who uses procmail to sort their incoming mail into different mailboxes.
Many of the mailing lists I subscribe to (including alug) insert the mailing list's name into the subject line. I got fed up with this as it wastes useful space that would be better used to show me the subject. I very often (used to) lose the end of the subject off the RHS of my screen. I already know what list the mail is from because procmail has put it pinto the appropriate list mailbox.
So I played around with my .procmailrc file, read the manual pages a few times and came up with the following recipe which removes the list name from the subject (as well as storing the mail in the appropriate mailbox, as before) :-
:0 fh * ^TOalug | sed 's/\[ALUG\]//' :0 A: alug
Interesting snippet, doesn't take in to account that you only really want to mess with the Subject: header though, does it. Which means that it will cheerfully play with any of the headers that happen to have [ALUG] in them. Not nice.
Try a bit of sed magic like this...
sed 's/^(Subject: .*)[ALUG] (.*)$/\1\2/;'
which will *only* play with the Subject header.
Hope that helps,