procmail
[Top] [All Lists]

Re: grabbing the third line of the body

1996-12-17 08:40:13
Timothy Luoma <luomat(_at_)peak(_dot_)org> writes:
...
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?

The 'f' and 'b' flags have no effect on nesting block recipes (i.e.,
the outer recipe here).  Rather, by doing the assignment as the action
of a recipe with the 'b' flag, you can pipe just the body into sed,
like this:

:0 b
LINE3=|sed -n 3p

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


Actually, I'd be tempted to change the second recipe to read:

:0 fh
* LINE3 ?? [^   ]
|formail -I"Subject: $LINE3"


The condition will require LINE3 to contain at least one non-blank
character (the brackets above contain a space and a tab).  Thus the
subject won't get replaced by a 'nothing'.

Philip Guenther

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