Johannes Tax wrote:
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 realize this is over a month old, but I've been away. All of the responses I saw to your question failed to mention ctags. ctags doesn't address the general question of finding a string inside multiple files, but it very well answers the specific question of finding a function definition in a tree of C source files. To get directly to the function definition of a_certain_function, the following will work: % ctags -R % vi -t a_certain_function If you just want to cat the file, try: % cat $(grep a_certain_function tags | cut -f 2) (After you've run ctags to build the tags file)