procmail
[Top] [All Lists]

Re: Extracting body text

2002-03-17 04:34:58
On 13 Mar 02, James Ervin (listuser(_at_)kites(_dot_)org) wrote:
List:

I want to put the body text in a variable to use in procmail, something 
like this in perl:

#!/usr/bin/perl
undef $/;
#$/='';
while (<>) {
        m#Content-Type: text/plain(.*?)Content-Type=#sm;
        print $1;
        exit;
        }

This gets just the body text and not any attachments that may be 
included.  I am having trouble getting this to work on the command line, 
but am still playing with it.  Has anyone done this with a simple pipe to 
sed or awk?  If so I would welcome your examples.

This is one I've seen, from http://www.uwasa.fi/~ts/info/proctips.html#body
BODY_=sed -e '1,/^$/ d'
Though I've no idea how to use it.

-- 
Stephen Patterson http://www.lexx.uklinux.net/
steve(_at_)lexx(_dot_)uklinux(_dot_)net(_dot_)SPAM (remove spam to reply)
ICBM address 54-22-0N 0-28-0W  Linux Counter No: 142831 
GPG Public key: 252B8B37 available on public keyservers.

Attachment: pgpj3M6v18Bpn.pgp
Description: PGP signature

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