Re: Editing in VI

From: Barry Finkel (b19141@ACHILLES.CTD.ANL.GOV)
Date: Mon Sep 23 2002 - 12:04:48 EDT


>I have a need to edit an entry via a kron shell script.
>Input would be - nnnnnnnn@domain.name
>
>a) nnnnnnnn can be letters and/or numbers, special characters and be any
> length, uppercase or lower case .
>b) domain.name could be any length before and after the dot.
> example valied entries are A) harthosp.org
> B) ibm.com
> C) myname.ibm.com
>c) @ must be present
>
>This will be entered as a response to a question from an korn shell script
> echo "`hostname`: Enter the email address where you wish to have the
>output sent"
> read emailaddress
>
>What would the syntax be to edit for for this?

I know that others have posted replies, but I am not sure what you
want to do after you have read the emailaddress. Do you want to

     1) take whatever string has been entered by the user and do a
        replacement in a file? E.g.,

            sed `s/EMAIL/$emailaddress/`

     2) Or do you want to parse the $emailaddress string to insure its
        syntactic correctness (via the rules you stated)?

     3) Or do you want to parse the $emailaddress string according to
        RFC 822/2822 to insure that the userid portion is a
        sytactically correct userid and the node.domain portion is also
        syntactically correct? Note that your "nnnnnnnn can be letters
        and/or ..." rule above does not insure a syntactically valid
        userid via RFC 822/2822. This is an invalid userid:

             finkel.barry.s.

        per RFC 822/2822 because of the trailing "." character.

     4) Or do you want to verify that the node.domain portion reflects
        a valid nodename for receiving mail?

If you want item 4), then I have a script that uses the BIND-supplied
"host" command. I do not know if IBM supplies this "host" command
with AIX. There is no way to know if the userid portion of the
$emailaddress string represents a valid mailbox without trying to send
e-mail to the address.
----------------------------------------------------------------------
Barry S. Finkel
Electronics and Computing Technologies Division
Argonne National Laboratory Phone: +1 (630) 252-7277
9700 South Cass Avenue Facsimile:+1 (630) 252-4601
Building 222, Room D209 Internet: BSFinkel@anl.gov
Argonne, IL 60439-4828 IBMMAIL: I1004994



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:16:13 EDT