procmail
[Top] [All Lists]

Re: can't parse BIG file??

1997-01-30 15:17:02
Ricky Roque asked,

|  I have the following recipe.
|
| ># Parse news daily run output
| >:0
| >* ^Subject:.*news daily run output
| >* ^From: System Administrator <root(_at_)dn004(_dot_)dnsa(_dot_)or(_dot_)jp>
| >* !^X-Loop: ricky(_at_)dnsa(_dot_)or(_dot_)jp
| >{
| > :0 bfcw
| > | head -20
| >
| > :0 A
| > | formail -A "X-Loop: ricky(_at_)dnsa(_dot_)or(_dot_)jp" | $SENDMAIL -oi -t
| >}
|
|  It produces the following error.
|
| >procmail: Executing "head,-20"
| >procmail: Error while writing to "head"
| >procmail: Rescue of unfiltered data succeeded

As Stan Ryckman explained, either head is not on your system or it is
in a directory not in your procmailrc's $PATH.  In the latter case,
either add that directory:

        PATH:$PATH:/directory/where/head/is

or specify head in the recipe by its absolute path.

In the former case, try

  | sed 20q

as a substitute for head -20.

Now, this is the thing; you're getting mail for yourself, reducing its body
to the first twenty lines, and then mailing it back to yourself (-t will see
you as the recipient when you feed it to $SENDMAIL)!  So it seems that you
might as well just work on the original copy.  Also, you don't need both
the braces and the `A' flag when there are only two recipes and no
assignments.

   # Parse news daily run output
   # `c' is extraneous with `f' except to get logabstract if LOGABSTRACT=all
   :0bfw
   * ^Subject:.*news daily run output
   * ^From: System Administrator <root(_at_)dn004(_dot_)dnsa(_dot_)or(_dot_)jp>
   * !^X-Loop: ricky(_at_)dnsa(_dot_)or(_dot_)jp
   | head -20 # or sed 20q, or whatever works
    :0 A:
    | formail -A "X-Loop: ricky(_at_)dnsa(_dot_)or(_dot_)jp" >> folder

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