We help IT Professionals succeed at work.

Advanced searching with grep

There are huge source code with hundred files and hundred of thousands line of code and I have to find main function in this source code.

grep "main" ./*.c -RIl

Open in new window

Obviously this approach does not satisfy, because of huge output.

in source code, functions may be declared in this style
int
main(int argc, char *argv[])
{
}

Open in new window


Also, number of such style is unknown.
So I'm asking how to find function not text. is there any searcher programs which is able to search C functions?
Maybe you will recommend some regular expression?
Comment
Watch Question

The tool you're looking for is called ctags.

Author

Commented:
brilliant