procmail
[Top] [All Lists]

Re: Deleteing string of Text in Body

1998-04-16 00:50:23
Roshan Shah asked,

| I had a question for everbody, I want to have procmail setup so when it
| recieves a file with a certain string of text in the body, it should delete
| that string of text and send the mail back out to the pre-defined address.
| This string of text will always be on the first line it that helps any.

OK ...

First, we want to ignore it if it is anywhere except the first line of the
body.

Second, a question: should we delete the *entire* first line if the string
appears, or should we remove the string and leave the rest of the first line
intact?  (I'll cover both.)

Third, another question: do we keep a copy of the original?  (I'll assume
not for now.)

Fourth, a third question: do we keep a copy of the modified version?  (Again,
I'll assume not for now.)

To remove the entire first line,

 :0Bbfw # capital B *and* lower-case b
 * ^^.*string
 | tail +2
  :0A
  ! pre-defined address

To remove the string from the first line but leave the rest of the line
intact,

 :0Bbfw # capital B *and* lower-case b
 * ^^.*string
 | sed '1s/string//'
  :0A
  ! pre-defined address

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