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?
Nusrat NuriyevAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jmcgOwnerCommented:
The tool you're looking for is called ctags.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Nusrat NuriyevAuthor Commented:
brilliant
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Shell Scripting

From novice to tech pro — start learning today.