[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: GREP



Walter,

To search lots of files using grep.  I use find and grep together.  The
following example recursively searches all filenamess that end in "html"
from my home directory (/home/swann) that contain the phrase "hello".

 find /home/swann -name "*html" -exec grep hello {} \; -print

The last "-print" option will also print the filename of any match.

To perform the same search on ALL files

  find /home/swann -exec grep hello {} \; -print

Hope this helps.

 __________________________________________________________________________
| Bryan Swann (swann nosc mil)  803/974-4267   803/974-5080 (Fax)          |
| Eagan McAllister Associates, Inc.                                        |
|                                                                          |
|  "Everything must be working perfectly, cause I don't smell any smoke"   |
 --------------------------------------------------------------------------

On Thu, 24 Jul 1997, Walter Brandt wrote:

> Hi.  I hope someone here can help me.  I am still a newbie to Linux (well,
> in fact - Unix full stop).  My question is hopefully simple to answer.
> 
> Can someone please give me the command to search subdirectories for the
> occurrence of text within some files.  I can search all the files in a
> single directory, just not in subdirectories.
> 
> eg.
> grep -r *.* sometext
> 
> Any help would be greatly appreciated.  Can you please e-mail any responses
> to the newsgroup and my e-mail directly?
> 
> Many :)
> 
> 
> Walter
> 
> 
> --
>   PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
> http://www.redhat.com/RedHat-FAQ /RedHat-Errata /RedHat-Tips /mailing-lists
>          To unsubscribe: mail redhat-install-list-request redhat com
>                      with "unsubscribe" as the Subject.
> 
> 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]