grep "my string" `find .`
Mihai
Regards/MfG
Roland Titze
Leung Yuk Leong Daniel schrieb:
find . -name '*string*' -print
--
best regards from vienna |
hans | mayer (at) relay.bfl.at_SPAM
What is this -r switch?
grep: illegal option -- r
How about:
grep '<pattern>' `find .`
or better:
find . -exec grep 'pattern' {} \;
--
p_n__n__---- _____ Hector Davie
d ___--__|HH|| `---. Ascom Hasler AG, Berne, Switzerland
_T-------'__-|_________| hec...@tell.ascom.ch
'o=o ()()()-' o=o`-'o=o Phone: (+41) 031 999 28 86
This works for me too:
ls -R */pattern
One drawback is it will recursively list all subdirectories.
But only if you have GNU grep installed, which is not the Solaris default.
Leung Yuk Leong Daniel <yldl...@faith.csis.hku.hk> wrote:
--
John W. Kennedy
Gopi.
j...@frii.com wrote:
> % find . -type f -exec grep pattern {} /dev/null \;
>
Sent via Deja.com http://www.deja.com/
Before you buy.
It shouldn't fail when the list gets too long. That's the whole
purpose of "xargs" -- to fit just as many arguments onto the command
line as will be allowed.
The "find"/"xargs" combo will fail, though, when the filename contains
newlines or other special characters, since there is a stream of
newline-separated filenames going from one to the other, and it's
possible to disturb the structure by adding your own newlines.
- Logan
LS> The "find"/"xargs" combo will fail, though, when the filename
contains
LS> newlines or other special characters, since there is a stream of
LS> newline-separated filenames going from one to the other, and it's
LS> possible to disturb the structure by adding your own newlines.
Not a specific reply to your's, but
may I point everyone to this nice little tool called tgrep from Sun.
It does a multithreaded recursive grep (very fast on multi cpu
machines).
I don't know where I got it from (source code), but a search on the Web
should give the right answer.
Uwe
Apparently, according to http://www.bconnex.net/~ronw/tgrep/ , this
utility was written by someone else and used by Sun as an example of
threads-based programming. The reason I mention this is that the
version Sun used is said to be out of date.
- Logan
Yes, but if you use the GNU version of these, there's a -print0
option on the find and a -0 option to xargs which prints and expects
a null-terminated string, respectively. We use this version and
it has been quite successful.
--
Bill Wyatt (REMOVEw...@cfa.harvard.edu) "remove this" for email
Smithsonian Astrophysical Observatory (Cambridge, MA, USA)