From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 30-JUN-1989 06:57
To:	MRGATE::"ARISIA::EVERHART"
Subj:	SEARCH output of DCL command

Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Thu, 29 JUN 89 17:35:12 PDT
Received: from RML2.SRI.COM by KL.SRI.COM with TCP; Thu, 29 Jun 89 17:15:50 PDT
Date: Thu 29 Jun 89 17:16:11-PST
From: Ric Steinberger <RIC@RML2.SRI.COM>
Subject: SEARCH output of DCL command
To: info-vax@KL.SRI.COM
Message-Id: <615168971.480000.RIC@RML2.SRI.COM>
Mail-System-Version: <VAX-MM(243)+TOPSLIB(135)@RML2.SRI.COM>

The following command procedure allows searching for a pattern in the
output of a DCL command.  It's based on a program that appeared in Digital
News a few issues back.  Note the nice way to create a temp file name.

USAGE: @find string DCL_COMMAND [arg1 [arg2 ...] ]

$! FIND.COM - Execute a DCL command (params P2 - P8, if nec) to search for
$!		P1
$ facility = f$parse(f$environment("PROCEDURE"),,,"NAME")
$ tmp_file = "sys$scratch" + f$getjpi("","PID") + "$" + facility + ".tmp"
$ on warning then goto cleanup
$ on control_y then goto cleanup
$ define/user_mode sys$output 'tmp_file'
$ 'p2' 'p3' 'p4' 'p5' 'p6' 'p7' 'p8'		!run command
$ search 'tmp_file' 'p1'
$CLEANUP:
$ if f$search(tmp_file) .nes. "" then delete 'tmp_file';*
$ exit
-------

