#!/bin/sh
#	gce pattern file...
# Run grep, do a ClearCase checkout, and  edit  each  of  the  matched
# files.  For vi, the "+" option will position the cursor at the first
# instance of the pattern.

S=${S:-/vobs/nm/cmagent/src}
if [ ! -n "$EDITOR" ];then EDITOR=vi; fi
sleep 5
P="$1"
shift
sleep 5
F=`grep -l "$P" $*`
sleep 5
for f in $F
do
	cleartool co -nc $S/$f
	echo $f checked out now.
#	Ln -s $S/$f $f
	sleep 5
done
sleep 5
$EDITOR "+/$P/" $F
