procmail
[Top] [All Lists]

Re: Overwrite files and eliminate headers

1996-02-08 16:35:01
| jzc(_at_)sibs(_dot_)com writes:

| >I am using the following recipe to save an incoming message to
| >a file:
| >
| >:0:
| >* ^Subject: saveme
| >savedfile

| >I have two questions:
| >1. The file: savedfile contains not only message text but also
| >the email headers, how can I eliminate all the headers so Procmail
| >only saves the message body.

The `b' flag handles that.

| >2. When a new message arrives, the new message is appended to
| >the exiting savedfile. How can setup the recipe, so the new
| >message will overwrite the exiting savedfile.

For that, you need to clobber the existing file with a pipe to cat instead
of using a simple save.

Philip Guenther answered the same way but made one small mistake:

| # The 'b' flag indicates that procmail should only write out the body.
| # See the procmailrc(5) manpage for details.
| :0 b:
| *     ^Subject: saveme
| |cat >savedfile

Er, not quite.  The recipe's action is not a simple save-to-folder, and
the command after the pipe does not have an append redirector (">>"), so
there is no implicit name for the local lockfile.

The solution is to specify a name for the local lockfile:

  :0b:savedfile.lock
  * ^Subject: saveme
  | cat > savedfile

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