procmail
[Top] [All Lists]

Re: subject processing

1997-07-08 03:55:00
On Mon, 7 Jul 97 12:08 EDT,
process(_at_)qz(_dot_)little-neck(_dot_)ny(_dot_)us (Eli the Bearded) wrote:
       :0fhw
       * SUBPAT ?? \<re\>
       | sed "s/^$SUBPAT[    ]*/Subject: Re: /"

This is not necessary, because the proposed condition will match only
if the Subject line has one or more of the strings we're looking for. 

This still leaves leading whitespace of the actual Subject out of
the MATCH, which is something one ought to fix before putting this to
real use, but that shouldn't be too hard. (Can anyone spot the error?)
I'm not sure what you are asking. Are you talking about the case of
something like "Subject:             Real Subject"?

With a "Re: ", yes. I found my condition line would not always grab
all spaces after the "Re:" so I changed the sed script to look for
optional whitespace after the match (unfortunately with a couple of
typos, as you noted).

There still is the malignant case of stuff like:
     Subject: Re[32]: FW: Re: Re[15]: Sv: Re[9]:
             Re: Fw: Real Subject

I figured nobody would ever bring this up :-)
  You can of course feed the headers through formail -c to wrap this
back onto its own line. It appears that the $\MATCH will not contain
any trace of the newline, although it does contain all the whitespace
used to indent the second line.

Oh, and as a public answer to the question you asked about sizes:
  SIZE    RSS     COMMAND         (version)
   984    372     procmail        3.10
  1488    592     perl            5.004
  1644    768     procmail        3.11pre7 with perlembed
How would sed score here? 
     SIZE    RSS     COMMAND         (version)
      916    308     sed -e p        GNU 2.05

I don't have the possibility to compare different versions on the same
machine, but isn't GNU sed somewhat heavy? [Clutching at straws :-]

Here's something to compare with: 
                                      SunOS        Linux       Alpha
sed -n p huge files >/dev/null      55.0/15.8   71.74/27.35   5.3/1.8
perl -pe '' huge files >/dev/null  1:40.0/9.5  127.56/35.14   2.8/1.2

Linux has GNU sed, the other two something more or less obscure.
(Alpha probably BSD-ish, SunOS likely of SysV descent, I'd guess?).
SunOS tested with a subset of the Linux test material over NFS; Alpha
with completely different files and a smaller set -- in fact
/usr/include/* /usr/bin/* for lack of better material.

/* era */

-- 
Defin-i-t-e-ly. Sep-a-r-a-te. Gram-m-a-r.  <http://www.iki.fi/~era/>
 * Enjoy receiving spam? Register at <http://www.iki.fi/~era/spam.html>

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