#!/bin/bash # This script is licensed under the GPL revision 2, just in case anyone else # finds it useful :) # Originally written by Paul Laufer, September 1998 function search () { for BLAH in `find -follow -name "$1" 2>/dev/null` ; do ( if [ -f $BLAH ] ; then CRAP=`cat $BLAH 2>/dev/null | grep "$2"` if [ "$CRAP" ] ; then ( echo -e "\n--------" $BLAH "--------\n" echo "$CRAP" ) ; fi fi ) ; done } # Main # if [ -n "$2" ] ; then ( # if we have $2 then we have $1 :) search "$1" "$2" ) ; else ( echo -e "\nSyntax: srchfor \"filename wildcard\" \"search string\"\n" ); fi