#!/bin/bash # # Syntax: findgrepsub [grep_options] string file # # Purpose: Searches for string in file. Used as a subroutine in findgrep. # Created: Jan 7, 1997 by Bart De Schutter # Last revised: Jul 31, 2007 by Bart De Schutter # # See http://www.deschutter.info/util/scripts.html for the latest version of # this script. # Status: public # Category: files list=$(grep "$@" 2>/dev/null) if [ $? -eq 0 ]; then eval search_file="\$$#" echo FILE: ${search_file} echo "$list" | sed 's/^/ /' fi