#!/bin/sh
# purpose:   recursive grep
# arguments: $1 - search string  (enclose in "" if continues spaces)
#            $2 - Pattern which files should be grepped
CHECK=`echo $1 | sed "s/^\([^ ]*\) .*/\1/"`
if [ "_$CHECK" = "_" ] ; then 
  echo "Usage: $0 <search_string>"
  exit
fi
CHECK=`echo $2 | sed "s/^\([^ ]*\) .*/\1/"`
if [ "_$CHECK" = "_" ] ; then
  find . -type f -exec grep -s -l -i "$1" \{\} \;
else
  NAME=`echo $2 | sed "s/\*/\\\\*/"`
  find . -name $NAME -exec grep -s -l -i $1 \{\} \;
fi
