unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* find string in files
@ 2006-10-30  6:55 Gary Wessle
  2006-10-30 10:01 ` Pascal Bourguignon
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Gary Wessle @ 2006-10-30  6:55 UTC (permalink / raw)



how can I have the output of "$ grep -FHwire string path" in a window
in the same frame with each line hyperlinked so that by placing the
pointer and <RET> it takes me there?

this command is just a shell command to find exact string recursively
in a given path.

thanks

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

* Re: find string in files
  2006-10-30  6:55 find string in files Gary Wessle
@ 2006-10-30 10:01 ` Pascal Bourguignon
  2006-11-19 22:55   ` David Combs
  2006-10-30 10:31 ` Peter Dyballa
  2006-10-30 10:48 ` Mathias Dahl
  2 siblings, 1 reply; 5+ messages in thread
From: Pascal Bourguignon @ 2006-10-30 10:01 UTC (permalink / raw)


Gary Wessle <phddas@yahoo.com> writes:

> how can I have the output of "$ grep -FHwire string path" in a window
> in the same frame with each line hyperlinked so that by placing the
> pointer and <RET> it takes me there?

M-x grep RET (edit the command) grep -FHwire string path RET


> this command is just a shell command to find exact string recursively
> in a given path.

You'll probably want to keep -n

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

"Our users will know fear and cower before our software! Ship it!
Ship it and let them flee like the dogs they are!"

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

* Re: find string in files
  2006-10-30  6:55 find string in files Gary Wessle
  2006-10-30 10:01 ` Pascal Bourguignon
@ 2006-10-30 10:31 ` Peter Dyballa
  2006-10-30 10:48 ` Mathias Dahl
  2 siblings, 0 replies; 5+ messages in thread
From: Peter Dyballa @ 2006-10-30 10:31 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 30.10.2006 um 07:55 schrieb Gary Wessle:

> how can I have the output of "$ grep -FHwire string path" in a window

grep-find?

--
Greetings

   Pete

Ce qui été compris n'existe plus.    (Paul Eluard)

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

* Re: find string in files
  2006-10-30  6:55 find string in files Gary Wessle
  2006-10-30 10:01 ` Pascal Bourguignon
  2006-10-30 10:31 ` Peter Dyballa
@ 2006-10-30 10:48 ` Mathias Dahl
  2 siblings, 0 replies; 5+ messages in thread
From: Mathias Dahl @ 2006-10-30 10:48 UTC (permalink / raw)


Gary Wessle <phddas@yahoo.com> writes:

> how can I have the output of "$ grep -FHwire string path" in a
> window in the same frame with each line hyperlinked so that by
> placing the pointer and <RET> it takes me there?

Have you tried M-x grep RET ?

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

* Re: find string in files
  2006-10-30 10:01 ` Pascal Bourguignon
@ 2006-11-19 22:55   ` David Combs
  0 siblings, 0 replies; 5+ messages in thread
From: David Combs @ 2006-11-19 22:55 UTC (permalink / raw)


In article <873b96gm1j.fsf@thalassa.informatimago.com>,
Pascal Bourguignon  <pjb@informatimago.com> wrote:
>Gary Wessle <phddas@yahoo.com> writes:
>
>> how can I have the output of "$ grep -FHwire string path" in a window
>> in the same frame with each line hyperlinked so that by placing the
>> pointer and <RET> it takes me there?
>
>M-x grep RET (edit the command) grep -FHwire string path RET
>
>
>> this command is just a shell command to find exact string recursively
>> in a given path.
>
>You'll probably want to keep -n


(Absolutely keep -n  --  that's what emacs uses to go-to
  that line!)


Here's what I do:

In *shell*:

  egrep -in mypattern set-of-files-to-look-in > t.loc
   (note: you MUST either list TWO-or-more files (so as
    to get the file-names in the t.loc lines),
   or accomplish the same via the gnu-egrep option that forces that.

Then, do M-x grep

   and CHANGE the offered grep-stmt to "cat t.loc"

   and THEN hit <return>.

My reason for doing it in these two steps:

.  Enables me to mess around, make mistakes, retry, etc,
    the egrep (OR WHATEVER!) to create that t.loc output-file.

.  The "or whatever!":  all emacs cares is that t.loc 
    LOOKS LIKE the result of a grep -n --
    ie, has lines of the form:

     relative-or-absolute-path-name COLON lineNum COLON (optionally!)the-text-at-that-lineNum

.  about that "(optionally!)the-text..." -- emacs (it seems to me) totally
   *ignores* that text, relying solely on the target line-number.

   THUS -- you can do what ever you want to that egrep-found text --
    such as when running through some text someone has written,
    and you want to make sure that the word "which" wasn't used
    where a "that" would have been better,

  you can modify your t.loc from, say, 

 foo.txt:100:Now is the time for a good man, which is sorely needed in 
 foo.txt:123:that is the location which I saw yesterday when
 foo.txt:147:and she was the date which he went to the
 ...
    
 foo.txt:100:Now is the time for a good man, **WHICH** is sorely needed in 
 foo.txt:123:**THAT** is the location **WHICH** I saw yesterday when
 foo.txt:147:and she was the date **WHICH** he went to the
 ...
 
, enabling you to easily spot all uses of that and which in *grep* --
yet when you ^C^C on a *grep* line, the corresponding one it goes
to, in the actual target file, has *not* been modified.

Nifty.


Also, I believe I had success when using the egrep options -A and -B,
to get surrounding context.


And, you can write your own program or script to hunt down interesting
places in files -- just so your output t.loc file *appears to emacs*
to be output from grep -n.

I hope these hints aid others -- they sure have helped me! 

David

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

end of thread, other threads:[~2006-11-19 22:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-30  6:55 find string in files Gary Wessle
2006-10-30 10:01 ` Pascal Bourguignon
2006-11-19 22:55   ` David Combs
2006-10-30 10:31 ` Peter Dyballa
2006-10-30 10:48 ` Mathias Dahl

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).