How to find files containing a specific word ?

Issue :

How to find files containing a specific word and store the results in another text file ?

Solution :

Use the following command :

grep -R word /directory/* > filename

Use -iR instead of -R for case insensitive search.
This approach will take some time depending on the size and number of files.

A faster method is to use the locate command.

First run the following command to create/update the search database:

updatedb

Then run the following command :

locate string > results.txt

Filed Under: Quick fixesTechnical

Tags:

About the Author: InstaCarma is a provider of Enterprise Class Solutions for the Hosting Industry

RSSComments (0)

Trackback URL

Leave a Reply

Get Adobe Flash playerPlugin by wpburn.com wordpress themes
InstaCarma provides outsourced web hosting technical support, helpdesk management, datacenter automation, cloud service management. Sales - 1800 810 6547 - visit www.instacarma.com