grep substr -H -r  *html

breakdown:

grep = look inside a file

substr = look for this string

-H = Tell me the name of the file you find with said substr

-r =    recursively look down through the current folder, ie look in all
folders and subfolders in the current directory.

*html = everything with html at the end of the file. NO . is needed in
*nix. That's sooooo DOSsy.

Ash


Jacob Fugal wrote:
> 
> Ross Werner wrote:
> > On Mon, 15 Sep 2003, Jacob Fugal wrote:
> >
> >>Many times I've run into a situation where I want to grep somethingin
> >>every file of a particular type in a certain directory tree recursively.
> >>For example, find all the html files (*.html filemask) containing
> >>'substr' in myDir/.
> >>
> >>I can write my own script to choose the files and then apply grep to
> >>them, and I can apply a find/xargs combo, but I was just wondering if
> >>anyone knew of some other elegant, 'shweet' way of doing this?
> >
> >
> > I don't have an elegant nor "shweet" way of doing it, but I found online
> > somewhere this:
> >
> > grep 'substr' *.html */*.html (and even needed, another */*/*.html)
> >
> > which will work for 99% of the things you want to do. It's not elegant, by
> > any definition of the word, but it's a quick hack and it's a few
> > keystrokes shorter than your piping-to-egrep version.
> 
> I didn't know that you could do */*.html and such in a filemask
> (although now that I think of it, why not?), so that's a useful bit of
> information. Don't think it'll be much help though in my case because
> the directory tree in question is pretty deep.
> 
> Jacob
> 
> ____________________
> BYU Unix Users Group
> http://uug.byu.edu/
> ___________________________________________________________________
> List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

____________________
BYU Unix Users Group 
http://uug.byu.edu/ 
___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to