procmail
[Top] [All Lists]

Re: insert one line at the top of incoming message

1998-03-27 07:37:55
"Ken" == Ken Hooper <bighouse(_at_)type2(_dot_)com> writes:

    >> * ^Newsgroups: ()\/.* | formail -A"X-NOTICE: This message was
    >> also posted to $MATCH"

    >> But that puts it into an X-header and I'd prefer into the body
    >> of the message...

    Ken> Maybe I'm missing something but this looks exactly like the
    Ken> problem I just finished looking at a few days ago. Let's put
    Ken> "This message was also posted to $MATCH" into
    Ken> posted-to.txt. Philip Guenther suggests code like this:

    Ken>        or this if you want to do it all in the recipe:

    Ken> # Note the space between "$" and "a"!  | sed "$ a\\ This
    Ken> message was also posted to $MATCH.\\ \\ "

This puts the message at the end of the file.  To enter a line at the
beginning of the file, you need to use "i."  

* ^Newsgroups: ()\/.* | sed -e '1 i\
\                           # add an empty line
Posted to newsgroup\
\'                          # add an empty line

As far as I can see, sed will not expand shell variables, so unless
procmail expands the variable before it passes the command to sed (I
don't know -- does it?), it would be impossible to put in the name of
the newsgroup in a simple manner like that.  

mp

                Michael Powe       looie(_at_)teleport(_dot_)com
                 pgpk -a finger://teleport.com/looie
  Portland, Oregon, USA   "Home of the Summer Wiener Dog Nationals"







"Let it alone; let's to billiards:  come, Charmian."  <Cleopatra>
-- William Shakespeare