unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* find-grep and complicated patterns
@ 2006-12-13  2:35 Lennart Borgman
  2006-12-13  3:07 ` Miles Bader
  2006-12-13  4:23 ` Eli Zaretskii
  0 siblings, 2 replies; 4+ messages in thread
From: Lennart Borgman @ 2006-12-13  2:35 UTC (permalink / raw)


find-grep is useful, but a bit hard with complicated patterns. How do 
you for example do something like this:

   find . -name "*.el" -type f -print0 | xargs -0 -e grep -nH -e "aaa bbb"

where there is a space in the pattern? The above does NOT work! Is this 
platform dependent? (On w32 you may use Cygwin or Gnuwin32+cmd.exe here.)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: find-grep and complicated patterns
  2006-12-13  2:35 find-grep and complicated patterns Lennart Borgman
@ 2006-12-13  3:07 ` Miles Bader
  2006-12-13  4:23 ` Eli Zaretskii
  1 sibling, 0 replies; 4+ messages in thread
From: Miles Bader @ 2006-12-13  3:07 UTC (permalink / raw)
  Cc: Emacs Devel

Lennart Borgman <lennart.borgman.073@student.lu.se> writes:
>    find . -name "*.el" -type f -print0 | xargs -0 -e grep -nH -e "aaa bbb"
>
> where there is a space in the pattern? The above does NOT work! Is this 
> platform dependent?

Apparently so because it works fine for me (debian)...

-Miles

-- 
Ich bin ein Virus. Mach' mit und kopiere mich in Deine .signature.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: find-grep and complicated patterns
  2006-12-13  2:35 find-grep and complicated patterns Lennart Borgman
  2006-12-13  3:07 ` Miles Bader
@ 2006-12-13  4:23 ` Eli Zaretskii
  2006-12-13  6:32   ` Jari Aalto
  1 sibling, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2006-12-13  4:23 UTC (permalink / raw)
  Cc: emacs-devel

> Date: Wed, 13 Dec 2006 03:35:07 +0100
> From: Lennart Borgman <lennart.borgman.073@student.lu.se>
> 
>    find . -name "*.el" -type f -print0 | xargs -0 -e grep -nH -e "aaa bbb"
> 
> where there is a space in the pattern? The above does NOT work! Is this 
> platform dependent? (On w32 you may use Cygwin or Gnuwin32+cmd.exe here.)

I suspect that this is a bug in the Windows port of xargs: when it
invokes Grep, the quotes are already stripped, and it fails to quote
them again.

But the only way to be sure that my guess is correct is to see what
arguments Grep sees.  I suggest to write a short test program that
displays its argv[] array, then invoke it instead of Grep, and see
what it says.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: find-grep and complicated patterns
  2006-12-13  4:23 ` Eli Zaretskii
@ 2006-12-13  6:32   ` Jari Aalto
  0 siblings, 0 replies; 4+ messages in thread
From: Jari Aalto @ 2006-12-13  6:32 UTC (permalink / raw)


Eli Zaretskii <eliz@gnu.org> writes:

> > Date: Wed, 13 Dec 2006 03:35:07 +0100
> > From: Lennart Borgman <lennart.borgman.073@student.lu.se>
> > 
> >    find . -name "*.el" -type f -print0 | xargs -0 -e grep -nH -e "aaa bbb"
> > 
> > where there is a space in the pattern? The above does NOT work! Is this 
> > platform dependent? (On w32 you may use Cygwin or Gnuwin32+cmd.exe here.)
> 
> I suspect that this is a bug in the Windows port of xargs: when it
> invokes Grep, the quotes are already stripped, and it fails to quote
> them again.

cmdproxy may treat them differently. At least:

        dos> echo foo | something
                  ====

is treated like

        "foo "

If there is no extra space before pipe(|) character:

        dos> echo foo|something

then it's treated like:

        "foo"

Jari

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-12-13  6:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-13  2:35 find-grep and complicated patterns Lennart Borgman
2006-12-13  3:07 ` Miles Bader
2006-12-13  4:23 ` Eli Zaretskii
2006-12-13  6:32   ` Jari Aalto

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).