-----BEGIN PGP SIGNED MESSAGE-----
On Thu, 26 Sep 1996, Professional Software Engineering wrote:
At 12:53 PM 9/26/96 -0500, yan(_at_)ns1(_dot_)wwisp(_dot_)com wrote:
[snip]
I want to for every message comes from news(_at_)mci(_dot_)com to be
stored in
a local file, then I need to invoke a system perl script to operate on
that file, how in the world would I do that?
:0c: lockfilename
* ^From:(_dot_)news(_at_)mci(_dot_)com
archive_filename
:0a: lockfilename
| ( perlscript archive_filename ; rm archive_filename )
You'll get into trouble when two messages arrive at the same time. You
can avoid that if you do this:
# There's a space and a tab between the brackets
:0: lockfilename
* ^From:[ ]*news(_at_)mci(_dot_)com
{
# lockfilename applies to all recipies between the braces
:0c
archive_filename
:0ai # `i' flag added because the script doesn't read stdin
| (perlscript archive_filename ; rm archive_filename)
}
I'm far from a *NIX guru (nor do I have aspirations to be one), but I know
there is some way to actually pipe to a file inside the same recipe, so that
this doesn't need to be a two-parter -- I just don't know what that
construct would be.
If you modify your perl script to read from stdin, you can do it in one
step. If you don't use seek() on your input file, I think you can even write
:0
| perlscript - # or even just "| perlscript"
without changeing your script. If you want to collect the output of the
script in a file, use:
:0:
| perlscript >>perlscript_output
Procmail Pros: I'm at a loss for how you'd run a filter that wouldn't
bother passing the data on stdin - how would one accomplish this?
Check the `i' flag in the procmailrc(5) man page.
- --
Guy Geens <guy(_dot_)geens(_at_)elis(_dot_)rug(_dot_)ac(_dot_)be>: Ph.D.
student at ELIS -- TFCG / IMEC
Home Page: http://www.elis.rug.ac.be/ELISgroups/tfcg/staff/gg.html
finger ggeens(_at_)elis(_dot_)rug(_dot_)ac(_dot_)be for PGP public keys (or use
keyserver)
-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: noconv
Comment: pgp fingerprints in message headers
iQBVAwUBMkuVgHwHoCha5QR1AQGgCgIAiCJgJtclFLB6t7+m/yK0yFDi1d0Cg2Sk
ifmAYrueHXndywsyuAYmhAOj6KwS6wau3kMlFvqQgYrjKC+amdS0uw==
=Y8AE
-----END PGP SIGNATURE-----