Subject: | |
From: | |
Reply To: | |
Date: | Fri, 20 Nov 1998 09:06:31 -0800 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
John Korb writes:
> I'm trying to do a "grep" on all files in a particular directory and all
> its subdirectories and I'm running into some problems. Perhaps one of the
> POSIX gurus knows a solution. Here is what I have tried (and what I've
> learned):
...deletia...
> o I know that "ls -Rx1 /COMM/DOC/html" will generate a list of files
> in the directory and its subdirectories, but it doesn't produce a
> list of "fully-qualified" file names. Instead, it lists the directory
> name and then lists the files in that directory, then a blank line,
> then the next directory name, then the list of files in that directory,
> etc. This is not suitable for "xargs" and "grep".
>
> Okay, what am I overlooking? How can I get "ls" to give me the kind of
> file listing that the "listfile,6" command (above) gives me (or is there a
> different command I should be using)?
You want to use "find" instead of "ls":
find /COMM/DOC/html -type f | xargs grep searchstring
The -type f says to return just files; the default is files *and* directories.
--
Mark Bixby E-mail: [log in to unmask]
Coast Community College Dist. Web: http://www.cccd.edu/~markb/
District Information Services 1370 Adams Ave, Costa Mesa, CA, USA 92626-5429
Technical Support Voice: +1 714 438-4647
"You can tune a file system, but you can't tune a fish." - tunefs(1M)
|
|
|