procmail
[Top] [All Lists]

Re: grabbing the third line of the body

1996-12-18 14:29:30
I have done everything I know to get off this list and nothing works. 
 I am now going to agina ask to be taken off the list since I can not
get off by sending the unsubscribe request to your server.  Effective
tommorrow, I will attach this list to my autoresponder and cause you
as much inconvenience as I am being caused by not being able to get
off the list.  That sounds like fair play to me.


Date:          Tue, 17 Dec 1996 00:39:17 -0800 (PST)
From:          Timothy Luoma <luomat(_at_)peak(_dot_)org>
To:            Tony Nugent 
<tony(_at_)trishul(_dot_)sci(_dot_)gu(_dot_)edu(_dot_)au>
Cc:            procmail(_at_)Informatik(_dot_)RWTH-Aachen(_dot_)DE
Subject:       Re: grabbing the third line of the body

I have sent off for the "best of procmail" list and expect it soon.

Oohaah!  Mention of this has gone by me... where/how can I get my
hands on this?

send a message to 

procmail-request(_at_)Informatik(_dot_)RWTH-Aachen(_dot_)DE

with the Subject

archive retrieval best_of_procmail_list.gz

or drop me a note and I can send it too, especially if you want it as
straight MIME (otherwise it comes as uuencoded)

 
Anyway, my current conundrum is this.

I get a certain mail message every day with the same subject from  
the same person.  The subject itself it _not_ very helpful.  What I  
would like is if I could get the third line of his email message,  
dump his useless subject, and replace the subject with the third  
line from the body.

It sounds easy enough, and I could do a 'head -3 | tail -1' to get  
it, but I'm not sure how to get that and replace the subject without  
destroying the rest of the message.

sed to the rescue.  This will grab the third line (and only the third
line) from any file:

sed -n 3p

So create a recipe that:
- looks for this message,
- filters a copy of the body of the message through sed and put the
  result into an environment variable, something like (untested):
    LINE3=|sed -n 3p
- send the message through formail to replace the current subject
  line with what you have obtained from line 3, eg:
    | formail -i"Subject: $LINE3" 
- deliver the message.

I'm unable to do this.

I've tried all the combination I can think of, but I keep getting the
third line of the header (I guess) not the body.

:0fb
{
        LINE3=`sed -n 3p`

        :0fh
        | formail -I"Subject: $LINE3" 
}       

Any clues?

enn(_at_)gnbc(_dot_)com
http://www.gnbc.com/mlm
http://www.gnbc.com/enn
Have your own Autoresponder
for only $9.95 per month  
Send E-mail to directory(_at_)gnbc(_dot_)com

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