Ooops. Sorry about that last post. I didn't RTFQ very well. If you just want a list of the filenames, use:
grep 'substr' -l -r *html -l = list files, but not the actual line. The last post I sent would actually list the line inside the file as well. Ash 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. > > ~ ross > > ____________________ > 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
