procmail
[Top] [All Lists]

Re: cutting off the ends of messages by matching a certain line

1996-12-17 00:56:26
On Mon Dec 16 1996, Timothy J Luoma wrote:

I am on several lists which insist on giving me a very long blurb  
(sometimes longer than the message itself) at the end of each  
message sent to the list.

The "real" part of the message always ends the same way, so I would  
like to use that as a "trigger" and have procmail dump the rest of  
the message.  Is this possible?  Is it advisable?  Clues?

Filter the message through sed.  As an example, this is what I use on
every message I get delivered (and it works _really_ well :)

 # strip out ALL trailing spaces and ugly PGP garbage
 #
 :0fBW
 * (BEGIN|END) PGP (SIG(NATURE|NED MESSAGE)|PUBLIC KEY BLOCK)
 | sed -e 's+ *$++' \
       -e 's/^- //' \
       -e '/BEGIN PGP SIGNED MESSAGE/d' \
       -e '/BEGIN PGP SIGNATURE/,/END PGP SIGNATURE/d' \
       -e '/BEGIN PGP PUBLIC KEY BLOCK/,/END PGP PUBLIC KEY BLOCK/d'

As long as the start/end strings that you look for at the same, then
the sed command '/start/,/end/d' will munch out the garbage that you
want to get rid of.  Easy, no?  :)

Cheers                               .
Tony                             _--_|\ 
    tony(_at_)trishul(_dot_)sci(_dot_)gu(_dot_)edu(_dot_)au  /     *\ 
T(_dot_)Nugent(_at_)sct(_dot_)gu(_dot_)edu(_dot_)au
    
ae(_dot_)nugent(_at_)student(_dot_)qut(_dot_)edu(_dot_)au\_(_dot_)--(_dot_)_/  
tnugent(_at_)cit(_dot_)gu(_dot_)edu(_dot_)au
    tony(_at_)sctnugen(_dot_)ppp(_dot_)gu(_dot_)edu(_dot_)au       v  Brisbane 
Qld Australia
   -=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-

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