For anyone who uses procmail to sort incoming mail
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 -- Chris Green (chris@areti.co.uk) "Never ascribe to malice, that which can be explained by incompetence."
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, -- Brett Parker web: http://www.sommitrealweird.co.uk/ email: iDunno@sommitrealweird.co.uk
On 2004-11-03 11:25:14 +0000 Brett Parker <iDunno@sommitrealweird.co.uk> wrote:
it will cheerfully play with any of the headers that happen to have [ALUG] in them. Not nice.
Correct.
sed 's/^\(Subject: .*\)\[ALUG\] \(.*\)$/\1\2/;' which will *only* play with the Subject header.
Why not sed '/^Subject: /s/\[ALUG\]//' # instead? The leading regex means that the s command will only act on matching lines. -- MJR/slef My Opinion Only and not of any group I know Creative copyleft computing - http://www.ttllp.co.uk/ Unsolicited attachments to the pipex address deleted Will HLF fund tree-killings? http://www.thewalks.co.uk/
On Wed, Nov 03, 2004 at 11:42:16AM +0000, MJ Ray wrote:
On 2004-11-03 11:25:14 +0000 Brett Parker <iDunno@sommitrealweird.co.uk> wrote:
it will cheerfully play with any of the headers that happen to have [ALUG] in them. Not nice.
Correct.
sed 's/^\(Subject: .*\)\[ALUG\] \(.*\)$/\1\2/;' which will *only* play with the Subject header.
Why not sed '/^Subject: /s/\[ALUG\]//' # instead? The leading regex means that the s command will only act on matching lines.
Purely because I pulled it out of my arse, and it was an improvement on the previous. Yours is probably quicker, overall, though. Cheers, -- Brett Parker web: http://www.sommitrealweird.co.uk/ email: iDunno@sommitrealweird.co.uk
On Wed, Nov 03, 2004 at 11:25:14AM +0000, Brett Parker wrote:
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.
I realised this but decided it was almost certainly irrelevant, what other (significant) part of the header is remotely likely to have the string '[ALUG]' in it? It's only if I reply to a message that the change will get out again anyway. -- Chris Green (chris@areti.co.uk) "Never ascribe to malice, that which can be explained by incompetence."
participants (4)
-
Brett Parker -
Chris Green -
Jenny Hopkins -
MJ Ray