procmail
[Top] [All Lists]

Re: Removing list identification from subject

2002-02-13 08:42:21
On 13 Feb, José Romildo Malaquias wrote:
| Hello.
| 
| Nowadays many mailing lists uses the list name at the
| begining of the subject of the messages, for the
| purpose of identification of list. For example:
| 
|   Subject: [Xpert]writing an XFree86 module device driver, need help!
|   Subject: Re: [Xpert]writing an XFree86 module device driver, need help!
| 
| are from two messages from the XFree86 Xpert mailing list.
| 
| I would like to remove this information from the subject
| of the this and other mailing list messages. Can anyone
| indicate how procmail can do that for me?

Offered only as *a* solution, not necessarily the best (or even
a good) solution.  It will get rid of the first "[tag]", ignoring any
that follow (e.g. Subject: [gone] hey [stays] wazzup?). It also should
handle any of:

Subject: [tag] hey wazzup
Subject: [tag] Re: hey wazzup
Subject: Re: [tag] hey wazzup

with the added bonus of "normalizing" whitespace, so there is always
one space after Subject: and one space after Re: (if it exists) no
matter how many there were, or weren't, originally. For those who curl
their noses at the perl sledge hammer, it was chosen over sed mostly for
it's simplicity with case insensitivity and whitespace... and because I
know it better. ;-)

:0fhw
* ^Subject:.*\[
| perl -pe 'next unless/^Subject:/i;s/\[[^]]+]//; \
        -e 's/(ject:(\s*Re:)?)\s*/$1 /i;s/(ject:)\s*(Re:)/$1 $2/;'

If you don't care about normalizing whitespace, then use just the first
perl clause *without* the trailing line continuation character "\".

Beside the disclaimer that I just cooked this up, so won't warrant that
it actually works as advertised, I have to make one more point.

<soapbox>
Personally, I'm ambivalent to Subject: [tags]. What absolutely fries me
is those who enforce their preferences on the whole list in
contravention to list convention. IMO, if the tag is there, it should
remain when replying. Even more so, if they're not there but you inject
them locally, they *must* be removed before replying to the list. List
posts should *always* conform to list protocols. In the small number of
cases where I munge list subjects, I insert an X-Orig-Subj: header
locally so I can edit my Subject: in my replies.
</soapbox>

-- 
Reply to list please, or append "6" to "procmail" in address if you must.
Spammers' unrelenting address harvesting forces me to this...reluctantly.


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>