: $Workfile:   kixgrep.sh  $ $Revision:   1.0  $
#**********************************************************************#
#*                                                                    *#
#* Copyright (c) 2001 by Sun Microsystems, Inc.                       *#
#* All rights reserved.                                               *#
#*                                                                    *#
#**********************************************************************#


# kixgrep
# Uses grep command to find occurrences of a user-specified pattern
# in a bunch of user-specified files
# params: $1 pattern to be searched for enclosed in double quotes 
#	  $2 name of temporary file for grep output 
#         $3 ttyname for vi
#	  $4,$5 ... - names of files to be searched


GREPFILES=""

PATTERN=$1
shift

TOUTNAME=$1
shift

DEVICENAME=$1
shift

while test "$1"	
do
   GREPFILES="$GREPFILES $1"
   shift
done
grep "$PATTERN" $GREPFILES > $TOUTNAME
vi $TOUTNAME <$DEVICENAME >$DEVICENAME
/bin/rm -f $TOUTNAME
exit 0
