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

Re: Search for string in files



On Sat, 25 Aug 2007, 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?

Thanks a lot in advance,

Johannes

--
Johannes Tax
jo.ey@gmx.at


you could also do something like this:

find -type f -name "*.c" | xargs grep -il a_certain_function

-+-
8 out of 10 Owners who Expressed a Preference said Their Cats Preferred Techno.



Reply to: