Shell Script: Find Files Containing Text

Useful shell script 🙂

Find files that contain a text string:

grep -lir "some text" *
grep -lir "some text" *.php

The -l switch outputs only the names of files in which the text occurs (instead of each line containing the text), the -i switch ignores the case, and the -r descends into subdirectories.

Quoted from: http://snippets.dzone.com/posts/show/505

Advertisements