procmail
[Top] [All Lists]

Re: File Updating via Procmail

1997-08-19 22:32:55
On Tue, 19 Aug 1997 18:23:09 -0700, Jeff Halper <jeff(_at_)ihot(_dot_)com> 
wrote:
I want to create a procmail recipe that will do the following:
If the subject contains the word XYZ, then]
look for the first instance of 
#(_at_)#
And the last instance of 
#(_at_)#

Depending on how many you normally expect to find, or possibly if you
are prepared to get the sender to somehow escape any in-band
occurrences of this string, this is a simple sed script. (Nothing much
to do with Procmail, really.) If you really want to interpret this in
the strictest sense possible, you need to go to awk or Perl and write
a small script to look at the text after the second #(_at_)# and output it
if it sees more occurreces of this string. 

Take all the text between these two markers, and name it filefix.html,
and replace the current version of /user/public_html/filefix.html with
this new version that is between the markjers of the email message.

:0:
* Subject:(.*\<)?XYZ\>
| sed -e '1,/^#(_at_)#$/d' '/^#(_at_)#$/,$d' >/user/public_html/filefix.html

I know this can be done easily, but I just do not understand Procmail
well enough to make it do this.

If the condition is met, the message is piped to a piece of shell
script which does the rest. The Procmail part is not hard at all.

You might also want to look at the identity of the sender as part of
the conditions. (And for god's sake choose a different password :-)

Hope this helps,

/* era */

-- 
Defin-i-t-e-ly. Sep-a-r-a-te. Gram-m-a-r.  <http://www.iki.fi/~era/>
 * Enjoy receiving spam? Register at <http://www.iki.fi/~era/spam.html>

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