Recursive grep without grep -r
Bumped into this situation recently on a Solaris system. I wanted to do a recursive grep, using the -r flag. That flag is not standard, so I was stuck until I whipped up this little diddy.
After navigating to the directory that you want as the root of the search, enter
It will only show the entries that match that pattern. Don't forget that you can also add in addition filters to the find command to limit the search file types, if so needed. So, by way of example, if you wanted to find every time you used the word Vista in your home directory, open up the command line and enter:
My search returned nothing ;-)
After navigating to the directory that you want as the root of the search, enter
find . -type f -exec grep <pattern> {} \;
It will only show the entries that match that pattern. Don't forget that you can also add in addition filters to the find command to limit the search file types, if so needed. So, by way of example, if you wanted to find every time you used the word Vista in your home directory, open up the command line and enter:
[user@host ~]$ find . -type f -exec grep Vista {} \;
My search returned nothing ;-)