Finding files containing 'string'

Neil Cherry ncherry at comcast.net
Wed Feb 1 17:20:41 UTC 2006


Paul Howarth wrote:
> Anne Wilson wrote:
>> I need to list all files that refer to my network-name, but I can't 
>> work out a command to do it.  I thought I would have to cat 
>> everything, piping through grep 'string', but that doesn't search 
>> recursively, the help-file doesn't show a recursive flag, and I'm not 
>> sure that it would actually give me the filenames anyway.
> 
> For a multitude of different ways of doing this, check out the thread 
> from last month where the same question was asked:
> 
> http://www.redhat.com/archives/fedora-list/2006-January/msg02876.html
> 
> My personal favourite solution for this problem:
> 
> $ grep -i -r -l 'string' /place/to.start/searching
> 
> This would have been much easier to find in the archives if the OP from 
> last month had used a sensible Subject: and hadn't hijacked another 
> thread of course.

That works well on files with spaces and other special characters
just doesn't work well with links that aren't there. ;-) Thanks
that fixed the spaces problem I was having and it found some broken
links I didn't know I have (really need to run the FS tools).

-- 
Linux Home Automation         Neil Cherry       ncherry at linuxha.com
http://www.linuxha.com/                         Main site
http://linuxha.blogspot.com/                    My HA Blog
http://home.comcast.net/~ncherry/               Backup site




More information about the fedora-list mailing list