Re: procmail recipe for a given message body
- From: Giorgos Keramidas <keramida@xxxxxxxxxxxxxxx>
- Date: Mon, 03 Sep 2007 03:37:58 +0300
On Sun, 02 Sep 2007 13:16:36 +0200, Keve Nagy <nospam@xxxxxxxxxxxxxxx> wrote:
Hi Everyone,
Some of you experienced with procmail hopefully can help me out
with this. I am trying to construct a procmail recipe which
filters for a given message-body.
I a cron scheduled script which do a shutdown as its final
instruction always generates a mail with the message body of:
_example_starts_here_
shutdown: [pid 1315]
Shutdown at Thu Aug 30 06:42:35 2007.
Shutdown at Thu Aug 30 06:42:35 2007.
System shutdown time has arrived
_end_of_example_
As you can see the pid. the date and time is always expected to
be defferent, but the rest of the message is constant. I'd like
to filter these messages out.
You can always use a regular expression to match the parts which
happen to "change over time":
:0 B
* ^shutdown: \[pid [0-9][0-9]*\]
/dev/null
I wasn't able to put together the facts on how to construct a
recipe for that. If you have a suggestion or a pointer to an
example or guide on this, please let me know. Unfortunatelly,
none of the procmail articles on the web I came accross dealt
with filtering for a given message-body.
It's probably going to be a bit more "resource intensive" to
filter messages based on regular expression matches on the "body"
of the message, but since you need it it's probably ok. The part
of the message which matching rules are applied to can be
controlled by the "flags" after the :0 part. I've used "B" there
to ask procmail to match the "body" of the message, instead of
the "headers".
For future reference, the "flags" are explained in the
procmailrc(5) manpage, near the part which says:
% Recipes
% A line starting with ':' marks the beginning of a recipe.
% It has the following format:
%
% :0 [flags] [ : [locallockfile] ]
% <zero or more conditions (one per line)>
% <exactly one action line>
%
% Conditions start with a leading `*', everything after that
% character is passed on to the internal egrep literally,
% except for leading and trailing whitespace. These regular
% expressions are completely compati- ble to the normal
% egrep(1) extended regular expressions. See also Extended
% regular expressions.
%
% Conditions are anded; if there are no conditions the result
% will be true by default.
%
% Flags can be any of the following:
%
% H Egrep the header (default).
%
% B Egrep the body.
%
% [ more flags explained here ]
.
- References:
- procmail recipe for a given message body
- From: Keve Nagy
- procmail recipe for a given message body
- Prev by Date: Re: USB storage device mount problem
- Next by Date: Serial port questions
- Previous by thread: Re: procmail recipe for a given message body
- Next by thread: Re: procmail recipe for a given message body
- Index(es):
Relevant Pages
|