I search a way to grep on source code without having sometimes false-positive because of comments. For instance if I search on foo on this .c source code :
/*
* foo has changed [...] and is now a 2-parameters function
*/
// foo(24)
foo(42, 28);
A naive grep
will find 3 occurrences where I want only one. I have seen this way to do it on StackOverflow, but it does not fill my needs : PHP is not available on the platform. I have also found this way for one-line comments, but it only solves a part of my problem.
I need to use classical scripting tools (awk, sed, bash, grep, etc) and I need it to be fast even if there are thousands of files.
Do you now if and how it's possible to grep on source code, and only source code ?