Networker

Re: [Networker] nsradmin regular expressions

2002-09-26 17:56:33
Subject: Re: [Networker] nsradmin regular expressions
From: Tim Mooney <mooney AT DOGBERT.CC.NDSU.NODAK DOT EDU>
To: NETWORKER AT LISTMAIL.TEMPLE DOT EDU
Date: Thu, 26 Sep 2002 16:56:31 -0500
In regard to: [Networker] nsradmin regular expressions, Joel Fisher said...:

>I'm trying to do some nsradmin queries using regular expressions(without
>a lot of luck).

That's because you're not doing your regular expressions correctly.  You
seem to be mixing the glob() semantics of `*', which is *not* the same as
its semantics for regular expressions.

>I've used the below file and it works great
>
><------START NTsystems.fil
>. type:nsr client; client os type: ^Windows NT*

That says: "Any string that begins with

        Windows N

followed by 0 or more occurrences of the previous regular expression,
which in this case happens to be T

That means your RE will match any of:

        Windows N
        Windows NT
        Windows NTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT

>show name; ;client os type; owner notification
>print
><------END NTsystems.fil
>
>. type:nsr client; owner notification: *joeuser AT wfubmc DOT edu*
>show name; ;client os type; owner notification
>print

That says "the string

        owner notification:

followed by 0 or more spaces, followed by the string

        joeuser@wfubmc

followed by any one character, followed by the string

        ed

followed by 0 or more u's.

>or
>
>. type:nsr client; owner notification: ^*joeuser AT wfubmc DOT edu*

I'm not even sure that's valid RE.  It says "0 or more occurrences of
the beginning of the line, followed by (the RE explained above)".

>show name; ;client os type; owner notification
>print
>
>The command I use for my 'owner notification' is:
>
>"/usr/ucb/mail -s "HOST Backup Completion"
>joeuser AT wfubmc DOT edu,billuser AT wfubmc DOT edu";

Then try:

        owner notification:.*joeuser@wfubmc\.edu.*

The `.' in front of the * is very important.  It seems like you're being
misled by how the shell handles * (aka globbing) vs. how RE's handle *.
They're significantly different.

>My goal is to replace every instance of joeuser AT wfubmc DOT edu with
>jimuser AT wfubmc DOT edu.

The problem is that there's no way to do backreferences that I'm aware of,
so in the example you show above, your *entire* owner notification will
be replaced with `jimuser...', rather than just the one part of the RE
that your selection matched.

Assuming you have access to some kind of mailing list capability (whether
it's editing the aliases file for your MTA on the NetWorker server or some
other box, or via mailing list software you have installed somewhere a la
Listserv/mailman/majordomo), my recommendation would be that you create
one or more owner notification addresses, and then use that in the owner
notification client resource.  That way you update the mailing list
(rather than the resource) when the membership changes.  i.e.

        "/usr/ucb/mail -s 'HOST Backup Completion' nsr-notify-unix";

and then create a `nsr-notify-unix' list for the people that need to see
the notifications for your UNIX platforms, a different list for your NT
admins, etc. etc.

Tim
--
Tim Mooney                              mooney AT dogbert.cc.ndsu.NoDak DOT edu
Information Technology Services         (701) 231-1076 (Voice)
Room 242-J6, IACC Building              (701) 231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164

--
Note: To sign off this list, send a "signoff" command via email
to listserv AT listmail.temple DOT edu or visit the list's Web site at
http://listmail.temple.edu/archives/networker.html where you can
also view and post messages to the list.
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=

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