procmail
[Top] [All Lists]

Re: egreping body for 'signoff'

1996-08-21 14:25:33
Antonio Bemfica asked,

| I subscribe to a busy list whose users seem to not understand the
| difference between the list address and the request address.  Anyways, I
| would like to filter all the messages that contain only the word 'signoff'
| on the body but not any messages that contain other words as well as
| signoff (in the event 'signoff' came up as a standard discussion topic, I
| guess).  The following recipe traps any messages containing 'signoff', not
| only the ones with the single word: 
| 
| :0 B
| * $signoff
| /dev/nul

Well, the dollar sign there probably doesn't mean what you expect (it
requires "signoff" to appear flush against the left margin), and the place
where you want to trash it is /dev/null with two l's, but to your question,
the following will lose any letter whose body contains just "signoff" or
"sign off" and no other printing text.  However, it will still pass mail that
has a .signature appended:

  :0Bb
  * ^^( |       |$)*sign ?off( |        |$)*^^
  /dev/null

The two sets of parentheses each contain space,pipe,tab,pipe,dollar.

To deal with .signatures, I'd recommend trashing anything where "signoff"
or "sign off" is the only printing text on the topmost non-blank line; the
parentheses enclose the same as those in the first suggestion, and the
brackets enclose a space and a tab:

 :0Bb
 * ^^( |        |$)*sign ?off[  ]*$
 /dev/null

You also might want to catch "quit" and "unsubscribe" -- I leave matching the
various ways people mistype "unsubscribe" as an exercise to the masochist, as
there will always be yet another you hadn't expected:

 :0Bb
 * ^^( |        |$)*(sign ?off|quit|unsubscribe)[       ]*$
 /dev/null

| Is this possible with procmail?

Does a bear log in from the woods?

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