On Feb 11, 2:06 am, Alexander Gattin wrote:
> Hello,
>
> On Tue, Feb 08, 2011 at 05:32:05PM +, Icarus
>
> Sparry wrote:
> > The key thing which makes this 'modern' is the
> > '+' at the end of the command, rather than '\;'.
> > This causes find to execute the grep once per
> > group of files,
Hello,
On Tue, Feb 08, 2011 at 05:32:05PM +, Icarus
Sparry wrote:
> The key thing which makes this 'modern' is the
> '+' at the end of the command, rather than '\;'.
> This causes find to execute the grep once per
> group of files, rather than once per file.
many thanks to you, man!
I'm surp
Hello,
On Thu, Feb 10, 2011 at 07:52:34AM +0100, Petter
Gustad wrote:
> r...@rpw3.org (Rob Warnock) writes:
> > invocation was given only one arg!! IT FOUND
> > THE PATTERN, BUT DIDN'T TELL ME WHAT
> > !@^%!$@#@! FILE IT WAS IN!! :-{
>
> Sounds frustrating, but grep -H will always
> print the fi
r...@rpw3.org (Rob Warnock) writes:
> invocation was given only one arg!! IT FOUND THE PATTERN, BUT DIDN'T
> TELL ME WHAT !@^%!$@#@! FILE IT WAS IN!! :-{
Sounds frustrating, but grep -H will always print the filename, even
when given a single filename on the command line.
//Petter
--
.sig remo
At 09:39 PM 2/9/2011, Rob Warnock wrote:
Harald Hanche-Olsen wrote:
[snip]
Years & years ago, right after I learned about "xargs", I got burned
several times on "find | xargs grep pat" when the file list was long
enough that "xargs" fired up more than one "grep"... and the last
invocation was
Harald Hanche-Olsen wrote:
+---
| [Icarus Sparry ]
| > The 'modern' way to do this is
| > find . -maxdepth 2 -name '*.html' -exec grep whatever {} +
|
| Actually, I think it should be
| find . -maxdepth 2 -name '*.html' -exec grep whatever /dev/null {} + \;
| because grep behaves d
Harald Hanche-Olsen wrote:
+---
| [Icarus Sparry ]
| > The 'modern' way to do this is
| > find . -maxdepth 2 -name '*.html' -exec grep whatever {} +
|
| Actually, I think it should be
| find . -maxdepth 2 -name '*.html' -exec grep whatever /dev/null {} +
| because grep behaves diff
Xah Lee writes:
>> You can rely on shell globbing, so that grep gets a list of all files in
>> all subdirectories. For example, I can grep all header files of the
>> linux kernel using
>>
>> % grep FOO /usr/src/linux/**/*.h
>
> say, i want to search in the dir
> ~/web/xahlee_org/
>
> but no mo
[Icarus Sparry ]
> The 'modern' way to do this is
> find . -maxdepth 2 -name '*.html' -exec grep whatever {} +
Actually, I think it should be
find . -maxdepth 2 -name '*.html' -exec grep whatever /dev/null {} + \;
because grep behaves differently when given only one filename as opposed
to sever
[Icarus Sparry ]
> The 'modern' way to do this is
> find . -maxdepth 2 -name '*.html' -exec grep whatever {} +
Actually, I think it should be
find . -maxdepth 2 -name '*.html' -exec grep whatever /dev/null {} +
because grep behaves differently when given only one filename as opposed
to several.
On Tue, 08 Feb 2011 14:30:53 -0800, Xah Lee wrote:
> On Feb 8, 9:32 am, Icarus Sparry wrote:
[snip]
>> The 'modern' way to do this is
>> find . -maxdepth 2 -name '*.html' -exec grep whatever {} +
>>
>> The key thing which makes this 'modern' is the '+' at the end of the
>> command, rather than '\
On Feb 8, 9:32 am, Icarus Sparry wrote:
> On Tue, 08 Feb 2011 13:51:54 +0100, Petter Gustad wrote:
> > Xah Lee writes:
>
> >> problem with find xargs is that they spawn grep for each file, which
> >> becomes too slow to be usable.
>
> > find . -maxdepth 2 -name '*.html -print0 | xargs -0 grep wha
Icarus Sparry writes:
> The 'modern' way to do this is
> find . -maxdepth 2 -name '*.html' -exec grep whatever {} +
Agree, I've noticed that recent version of find have the + option. I
remember in the old days the exec method was considered bad since it
would fork grep for each process, so I've
On Tue, 08 Feb 2011 13:51:54 +0100, Petter Gustad wrote:
> Xah Lee writes:
>
>> problem with find xargs is that they spawn grep for each file, which
>> becomes too slow to be usable.
>
> find . -maxdepth 2 -name '*.html -print0 | xargs -0 grep whatever
>
> will call grep with a list of filenam
Xah Lee writes:
> problem with find xargs is that they spawn grep for each file, which
> becomes too slow to be usable.
find . -maxdepth 2 -name '*.html -print0 | xargs -0 grep whatever
will call grep with a list of filenames given by find, only a single
grep process will run.
//Petter
--
.s
15 matches
Mail list logo