#! /bin/sh # # Filename: findstring # # Author: Br. David Carlson # # Date: December 4, 2000 # # This script looks for the string given as the command line paramter # in all regular files in the directory tree starting at the current # directory. The search is case sensitive. # # Syntax: findstring TMP="/tmp/fstr.$$" if [ $# -ne 1 ] then echo "One parameter needed -- the string to look for" echo "Syntax: findstring " exit 1 fi find . -type f > $TMP while read fname do RESULTS=`grep "$1" "$fname"` if [ -n "$RESULTS" ] then echo "$fname:" echo "$RESULTS" fi done < $TMP rm $TMP exit 0