Operating System - OpenVMS
1751866 Members
5359 Online
108782 Solutions
New Discussion юеВ

Re: To search multiple strings

 
anupav
Occasional Visitor

To search multiple strings

Hi,

 

I wrote a script for monitoring a remote box ( Unix box), for this i get the status of the server in a file and search for the faults, as i now need to modify the search, i would like to know if this is possible:

 

current search :

sear DISK1:[anup]out.txt ims,down/match=and

 

 this was used as there were 4 unix boxes, but now 2 of them have been removed and hence not required to be monitored, but the other 2 are to be monitored.

The names of the boxes are:

ims01, ims02, ims21, ims31

ims01 and 02 are no more required but 21 and 31 are required.

i need to search :

"(ims21 or ims31), down/match=and"

 is this possible?

Kindly help me identifying the possible solution.

Regards,
Anup
8 REPLIES 8
Hein van den Heuvel
Honored Contributor

Re: To search multiple strings

[ If you need further help with this, you may want to show the EXACT format of out.txt in the topic or TXT attachement. ]

 

Change the AND or and (implied) OR:

 

$ search/wild out.txt "ims21*down", "ims31*down"

 

or, use a search tool with regular expression capability, liek AWK or PERL

 

$ perl -ne "print if /(ims21|ims32).*down/i" out.txt

 

 

fwiw,

Hein

 

 

 

Dennis Handly
Acclaimed Contributor

Re: To search multiple strings

>I wrote a script for monitoring a remote box (Unix box),

 

Wouldn't it be easier to monitor your Unix boxes using Unix commands and scripts?

Mike Kier
Valued Contributor

Re: To search multiple strings

To add to Hein's post, if you are running TCP/IP Services, you likely have a flavor of awk on your system in SYS$COMMON:[SYSHLP.EXAMPLES.TCPIP.SNMP]GAWK

 

Flavors of perl are freely available, you just need to download and install them.

Practice Random Acts of VMS Marketing
Hoff
Honored Contributor

Re: To search multiple strings

It's easier to monitor VMS boxes from Unix servers, too.

And there are existing monitoring tools that can watch OpenVMS, and Mike mentions one of the main means for that: SNMP.
John Gillings
Honored Contributor

Re: To search multiple strings

Anup,

   The DCL SEARCH command doesn't do complex expressions. If you're recent enough, wildcards might help. If not, you can achieve what you want as a pair of searches piped together:

 

$ PIPE SEARCH DISK1:[anup]out.txt ims21, ims31 | SEARCH SYS$PIPE down

 So, the first SEARCH finds all lines containing "ims21" or "ims31" (easy to add any new nodes to the list). The second finds those containing "down".

 

That said, I'd go with Perl. You can be far more specific with a regular expression.

A crucible of informative mistakes
anupav
Occasional Visitor

Re: To search multiple strings

Thanks for the reply, but i am not in a position to install other tools for monitoring i am authorized to use only the DCL commands and write a script so that it can search. and the pipe command does not work here as the version is V6.2-1H2.

Regards,
Anup
abrsvc
Respected Contributor

Re: To search multiple strings

The following is somewhat crude, but with the restriction of V6.2, it should work.  Implement the "pipe" functions using a temp file.  Place the output of the first search into a temp file and then search that for "down".  Clean up the tempfile when done and there you go...

 

Dan

Mike Kier
Valued Contributor

Re: To search multiple strings

As far as perl goes, I guess it depends on what your management defines as "install" as there are versions that can be obtained or built that do not require a system-wide installation or special privileges.  It might be hard to find one pre-built and supported on a VMS release that old, but it may build.

 

You've also got TPU on the system (it is the foundation of the EVE editor).  It would take some effort to learn the syntax, but TPU is a language developed expressly for text processing and can be made to do nearly anything you want (both LSE and VAX Notes were implemented in TPU).  The TPU documents are available online with the regular VMS OS documentation.

 

Practice Random Acts of VMS Marketing