At 12:41 PM 8/20/99 -0500, David W. Tamkin wrote:
aggarwal asked,
| > if i get a message from joe(_at_)shmoe(_dot_)com with subject "hey there"
| > i would like to change the subject to "[shmoe] hey there"
Timothy Luoma responded,
| I think
|
|
| :0
| * ^From:(_dot_)*joe(_at_)shmoe\(_dot_)com
| {
| SUBJECT=`formail -zxSubject:`
|
| :0fhw
| | formail -I"Subject: [shmoe] $SUBJECT"
| }
|
| will do what you want
Better, because it uses one process fewer,
:0fhw
* ^From:(_dot_)*joe(_at_)shmoe\(_dot_)com
* ^Subject:[ ]*\/[^ ].*
| formail -I "Subject: [shmoe] $MATCH"
The first pair of brackets enclose space and tab; the second enclose caret,
space, and tab.
It is probably worth noting that these two approaches will differ
in their treatment of any mail that doesn't have a Subject: header.
Specifically, Timothy's will insert
Subject: [shmoe]
(give or take trailing white space), whereas David's will not add
a Subject: at all.
Cheers,
Stan