Johannes Tax wrote:
Hi,

I'm trying to figure out how to find a certain string inside a bunch of
files. If I, for examples, look for a certain function in a large source
tree, I could do

cat `find . -name '*.c'` | grep 'a_certain_function'

but this seems quite awkward, furthermore it doesn't help that much
because I don't know in which file the string was found. Maybe there's a
tool that makes it possible to find a string in a bunch of files and
also to list in which file the string was found? Or any modification to
the command given above?

I wrote a perl script that does this (and other stuff) - it's called 'deep' and available on my website:

http://www.neilgunton.com/doc/deep

In your example, you'd just do this:

shell> deep find 'a_certain_function'

And it tells you the file and line numbers where the matches were found. As the name implies, the script recurses on directories automatically. There are other features like replace, delete, do (cmd), etc.

/Neil


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to