procmail
[Top] [All Lists]

Re: Avoiding unnecessary call

2001-01-08 12:44:08
++ 07/01/01 13:55 -0600 - Philip Guenther:
          # Build a regexp to match the correct line.
          # The $\variable syntax escapes egrep-style regex metacharacters
          # and tacks "()" on to the front.  For example, if the newsgroup
          # name in MATCH were "nl.comp.lang.c++", then this would expand
          # to "^()nl\.comp\.lang\.c\+\+[     ].*[    ]Running\."

Just to be sure (english is not my first language), by using \$VAR
instead of just $VAR the variable will be expanded differently by
escaping metacharacters? Do i understand this correctly?

          # Note that this expansion _must_ be used with egrep and not grep:
          # parens aren't magical to grep, but \+ is!

          regex = "^$\MATCH[  ].*[    ]Running\."


          # The -q flag to egrep tells it to not print anything, just
          # set its exit code.
          :0
          * ? egrep -iq "$regex" ${VOTEDIR}/stemmingen.txt

The -i option isn't really needed, the only thing where this could
possibly go wrong is when i would write Running with different caps,
but true, it won't hurt.

On a related note, the whitespace as used in $regex is a space and tab.
Is order important here?

        -R.


-- 
# rejo(_at_)sisterray(_dot_)xs4all(_dot_)nl (pgp: see headers) - 
http://www.sisterray.nl
_______________________________________________
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>