procmail
[Top] [All Lists]

Re: Limiting extraction with \/

1999-01-07 01:53:25
:0:
* ^From[    ]owner-\/.*@
{
        LIST=`echo $MATCH|sed -e 's/@/\.gz/'`

        :0 w:
        |gzip -fc >> $LIST
}

I know its basic, but it compleately eludes me at this time.  

   :0 w:
   * ^From[      ]owner-\/[^@ ]*
   | gzip -fc >> archive-$MATCH.gz

This assumes that the address has only one '@' and contains no spaces.
The check for spaces is there in case your From_ line doesn't contain
a fully-qualified domain name.

I also prepended 'archive-' to the name of the outgoing file; this way
mail sent with an envelope address of 'owner-' or 'owner-@' won't
disappear into a file called '.gz'.  You could change it like

   :0
   * ^From[      ]owner-\/[^@ ]*
   {
      ARCHIVE="$MATCH"

      :0 
      * ARCHIVE ?? ^^^^
      { ARCHIVE="unknown" }

      :0 w:
      | gzip -fc >> $ARCHIVE.gz
   }

if you want mail that wouldn't match to go into 'unknown.gz' instead.

Chris

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