find . -exec grep "www.athabasca" '{}' \; -print

 This command will search in the current directory and all sub directories.
All files that contain the string will have their path printed to standard
output.

If you want to just find each file then pass it on for processing use the -q
grep option. This finds the first occurrance of the search string. It then
signals success to find and find continues searching for more files.

find . -exec grep -q "www.athabasca" '{}' \; -print

 This command is very important for process a series of files that contain a
specific string. You can then process each file appropriately. An example is
find all html files with the string "www.athabascau.ca". You can then
process the files with a sed script to change those occurrances of "
www.athabascau.ca" with "intra.athabascau.ca".


On Fri, Nov 14, 2008 at 3:14 PM, <[EMAIL PROTECTED]> wrote:

> Is there a command that finds a file containing a certain word?
>
> find and apropos don't. They work on filenames only.
>
> Using Hardy H.
>
> Any suggestions gratefully etc.
>
> Bill Bennett
> --
> SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
> Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
>



-- 
"Never Trust an Operating System You don't have the Source for..."
"Closed Source for device Driver are ILLEGAL and not Ethical... act!"
"Isn't it, MS Windows a real multitasking OS?, Why? 'Cause It can boot and
crash simultaneously!"
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to