John,
a real Unix expert gave me the hint to use the find command.
You may try this:
find ./ -type f -exec grep b {} \; -exec echo file {} \;
to find s.th. in all the files' content, (but very CPU intensive)
or
find /APACHE/ -type f |grep SCHMI
to find s.th. in the files' names.
Hope this helps, best regards, Andreas
[log in to unmask] on 11/20/98 02:45:47 PM
Please respond to [log in to unmask]
To: [log in to unmask]
cc: (bcc: Andreas Schmidt/HI/CSC)
Subject: A POSIX question
Another dumb question from a POSIX dummy (me).
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):
o Since "grep" only allows a file or directory (but no recursive
directories), I figured I'd use "ls" to generate a list of files in
the directory and its subdirectories, then use "xargs" to turn the
file names into targets for "grep".
o I know that in the CI I can use:
listfile /COMM/DOC/html/,6
to get a list of all files in the directory and all files in its
subdirectories, but this is an MPE solution and I'm trying to use
POSIX.
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)?
Thanks!
John
--------------------------------------------------------------
John Korb email: [log in to unmask]
Innovative Software Solutions, Inc.
The thoughts, comments, and opinions expressed herein are mine
and do not reflect those of my employer(s), or anyone else.
|