[plug] Search contents of a file

Colin Muller colin at durbanet.co.za
Fri May 26 18:35:25 WST 2000


"Earnshaw, Mike" wrote:
> 
> I am trying to locate files that contain some text, I know it must be
> easy but it eludes me :-(

If you have rgrep:

rgrep -rl "wanted word or phrase" startdir/*
 - will recurse through all files from startdir down. leave out the 'l'
from '-rl' to print the lines plus filenames, include it to list relvant
filenames instead.

if you don't have rgrep:
grep -l "wanted word or phrase" `find startdir -type f`
 - those are backticks before "find" and after "f". leave out the "-l"
to print lines plus filenames instead of just filenames.

For both grep and rgrep, add an 'i' to the switches to search
case-insensitive

-Colin



More information about the plug mailing list