This script will enable you to search any desired collection of files and folders with ‘find word’ or ‘find this phrase’
Start up the terminal
1. make the folder ‘f’ to put the files/folders/links to folders into.
2. add the script as a function to your .bash_profile, using the nano editor
a. type nano .bash_profile
b. paste this at the bottom of the file: (use arrow keys to navigate)
grep -r -n -i –word-regexp –color -C 1 “*” ./f/ | wc -l` occurrences of \”*” ./f/ | wc -l` as a whole word.
c. save and exit nano: ^O ENTER ^X
(^O is I think OPTION-O on Mac keyboards)
d. close the terminal window and open another (with File/New Shell) to process the bash_profile info
3. add the files and folders to search in, to the f file you just made in your home directory (probably /Users/admin/f)
Move to the new directory: cd f
Rather than physically put folders in the f folder, you can make shortcuts to them with:
ln -s dirtolink newshortcut
where dirtolink is the folder to be searched in (drag it onto the Terminal window is easiest), and newshortcut is the name of the shortcut to be created.
Now hopefully, typing f word will show all occurrences of the word in your selected files.