procmail
[Top] [All Lists]

Re: how to match a word in body ?

2002-07-25 05:37:42
On Wed, 24 Jul 2002, Michael Meltzer wrote:

May be I should explain a little bit more:

Wat I want to do is enable a user to start a little program in his account
by sending a mail to himself. He has to send a special subject and and in
the body two words: a password and a key so that the program can recognize
what the user wants to do. The key could also be a single letter. May be
there are better ways to do that ? It's only for a single user.

        Yes there are.  Instead of mail use "forced command" in SSH, while
        the command is a program that checks the SSH_ORIGINAL_COMMAND.
        Example for this command:

#/bin/sh
set $SSH_ORIGINAL_COMMAND
case $1 in
    ls|dump|date)
        [ "$2" = "MyPasswd" ] && $1
        ;;
esac

        This is not case for this mailig list.  If you insistent for
        procmail, David gave you the answer, try to paly with it.

Bye,
 Udi




Michael


"David W. Tamkin" wrote:

Michael asked,

| how can I match a word in the body (some text ThisWord some text)
| and pipe this word to a Program ?

Oh gosh.  Can you be sure that the word will have a spaces afte it, or will 
it
possibly be at the end of a line, or might there be a punctuation mark after
it?  Is it a literal word that has only letters of the alphabet in it?

 :0Bi
 * ()\<\/pattern to match the word\>
 * MATCH ?? ()\/[a-z]+
 | echo "$MATCH" | program

If there can be non-ASCII letters (such as German umlauted vowels or long
double s) in the word, adjust the bracketed range on the third line
accordingly.  Leaving the `D' flag off the flag line will allow for
case-insensitivity on straight Roman characters, but you might need to 
specify
both upper and lower case forms of non-ASCII letters, like this (if you're
reading in the same character set that I'm using for typing):

 * MATCH ?? ()\/[a-zäÄöÖßüÜ]+

--
+---- Michael Meltzer ---+-----------------------------------------+
|   SICAD Geomatics      |   EMail : 
Michael(_dot_)Meltzer(_at_)sicad(_dot_)de      |
|   Otto-Hahn-Ring 6     |   Phone : +49-89-636-46239              |
|   81739 Muenchen       |   Fax   : +49-89-636-51313              |
+------------------------+-----------------------------------------+
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail



--


_______________________________________________
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>