Saturday, October 31, 2009

Find files containing a word/phrase

If you are using cygwin on Windows or using Linux/Unix, here is a simple way to find the files containing a particular word or phrase:

find . -name '*.java' -exec grep -l 'phrase to search' {} \;

Note that this will do a recursive search inside the sub-directories as well. To search only in the current folder, the grep command is sufficient.

No comments:


Related Posts Plugin for WordPress, Blogger...