procmail
[Top] [All Lists]

Re: KalvjaNoDupProcmailrc

2001-07-24 05:35:46
* tris(_at_)semireal(_dot_)net(_dot_)dhis(_dot_)org 
<tris(_at_)semireal(_dot_)net(_dot_)dhis(_dot_)org> [010723 17:34]:
Hi there!

Can some of you experts comment on the procmail script below:


# No duplicate bodies below this point
# ====================================

 :0
        * !^Subject:.*KalvjaPass
        {
                CHECKSUM =`sed 1,/^$/d |grep -v ^$ |cksum`

                :0 a W h f
                |formail -i "Message-Id: $CHECKSUM"

                :0 a W h: DupCache.lock
                |formail -D 32768 .ProcmailDupCache

              :0 W h f
              |formail -R Message-Id X-Message-CheckSum  -u Old-Message-Id 
|formail -R Old-Message-Id Message-Id -U X-Message-CheckSum
        }


This script removes any message that has a body that has been seen before,
provided its checksum is still in the checksum cache.  Bodies are consider
to be the same even if the number of blank lines is different.  The script
works fine, but can it be made better?

You could combine the grep w/ the sed.

CHECKSUM=`sed -e '1,/^$/d' -e '/^$/d' | cksum`

You may even want to filter out lines w/ only whitespace as well as
blank lines.

CHECKSUM=`sed -e '1,/^$/d' -e '/^[  ]*$/d' | cksum`

-- 
- Matt Dunford <> zoot(_at_)zotikos(_dot_)com ..
-. www.zotikos.com -- o,;-
        
"Hatred is an affair of the heart: contempt that of the head."
   -- Schopenhauer, Parerga and Paralipomena
--
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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