3 # finds all files that contain any one of the members of a list of patterns.
5 function print_instructions()
7 echo "This script requires a directory as the first parameter and then a list of"
8 echo "patterns to find within that directory. All the files matching a pattern"
9 echo "in the list will be opened in an editor."
13 echo " $(basename $0 .sh) ~/feisty_meow hoople.net hoople.org"
14 echo "the above will search the directory ~/feisty_meow for all matches to"
15 echo "the two patterns 'hoople.org' and 'hoople.net'."
20 # capture the first parameter for the directory and remove it.
21 search_directory="$1"; shift
23 if [ -z "$search_directory" -o -z "$2" -o ! -d "$search_directory" ]; then
27 function launch_editor_on_matching_files()
29 pushd "$search_directory"
33 # iterate over the rest of the parameters as patterns.
36 echo "searching [$search_directory] for string [$donk]"
37 edit_list="$(bash $FEISTY_MEOW_SCRIPTS/text/search_text.sh $donk)"
38 if [ ! -z "$edit_list" ]; then
39 gvim $edit_list 2>&1 | cat
43 #hmmm: why doesn't the np alias work?
50 # invoke our function to do the real work.
51 launch_editor_on_matching_files $*
55 # example run for scanning feisty meow code for old domain names that are
57 # edit_files_matching $FEISTY_MEOW_APEX hoople.net hoople.org hoople.com yeticode.org yeticode.com yeticode.net cromp.com cromp.org cromp.net gruntose.net gruntose.org koeritz.net