help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

grep-find oddity


From: Tom Roche
Subject: grep-find oddity
Date: Sun, 21 Mar 2010 23:38:01 -0400
User-agent: GNU Emacs 23.1.50.1 (x86_64-pc-linux-gnu, GTK+ Version 2.18.0)

I'm running ubuntu=karmic package=emacs-snapshot, which is

GNU Emacs 23.1.50.1 (x86_64-pc-linux-gnu, GTK+ Version 2.18.0)
 of 2009-09-27 on crested, modified by Debian

When I do M-x grep-find with the argument

find . -type f -name '*.10*' -print0 | xargs -0 -e grep -nH -e '<respiratory>'

I get

*grep*
> -*- mode: grep; default-directory: "~/info/logs/" -*-
> Grep started at Sun Mar 21 23:27:38
>
> find . -type f -name '*.10*' -print0 | xargs -0 -e grep -nH -e '<respiratory>'
> ./logfile.100103:326:<respiratory>
> ./logfile.100110:529:<respiratory>
> ./logfile.100117:217:<respiratory>
> ./logfile.100124:186:<respiratory>
> ./logfile.100131:387:<respiratory>
> ./logfile.100207:836:<respiratory>
> ./logfile.100307:265:<respiratory>
> ./logfile.100214:271:<respiratory>
> ./logfile.100221:402:<respiratory>
> ./logfile.100314:488:<respiratory>
> ./logfile.100228:311:<respiratory>
> ./logfile.100321:731:<respiratory>
>
> Grep finished (matches found) at Sun Mar 21 23:27:38

which I expect. But when I try to do M-x grep-find with a nearly
equivalent but slightly more complex argument

find . -type f -name '*.10*' -print0 | sort | xargs -0 -e fgrep -nH -e 
'<respiratory>'

I get

*grep*
> -*- mode: grep; default-directory: "~/info/logs/" -*-
> Grep started at Sun Mar 21 23:23:15
>
> find . -type f -name '*.10*' -print0 | sort | xargs -0 -e fgrep -nH -e 
> '<respiratory>'
> ./logfile.100103:326:<respiratory>
> ./logfile.100110:529:<respiratory>
> ./logfile.100117:217:<respiratory>
> ./logfile.100124:186:<respiratory>
> ./logfile.100131:387:<respiratory>
> ./logfile.100207:836:<respiratory>
> ./logfile.100307:265:<respiratory>
> ./logfile.100214:271:<respiratory>
> ./logfile.100221:402:<respiratory>
> ./logfile.100314:488:<respiratory>
> ./logfile.100228:311:<respiratory>
> ./logfile.100321:731:<respiratory>
> fgrep: 
> : No such file or directory
>
> Grep exited abnormally with code 123 at Sun Mar 21 23:23:15

The latter seems wrong:
- output is unsorted: same 12 results, no change in order
- fgrep gets error (though it's in the path, works fine from xterm)
- grep exits abnormally

So I'm wondering:

0 Why does grep-find behave like this?

1 What should I do to process a more complex pipeline, but otherwise
  get grep-find behavior (i.e. present results in a buffer from which
  I can navigate to results)?

Apologies if this is a FAQ, but I didn't see anything in the *info*
(node=emacs, page=31.4 Searching with Grep under Emacs).

TIA, Tom Roche <Tom_Roche@pobox.com>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]