I have a bunch of files organized into directories..All these are text files (c/c++). I am trying to understand this code and i need to look at the declarations of many vari
find . -name *.c -exec grep -Hn "your search term here" {} \;
If you really want to use find
.
EDIT
explanation
find . -name *.c
- find files in current dir and below where name is like *.c
-exec
- execute command that follows
grep -Hn
- grep and print results with file name and line number of match
{} \;
- {} marks where the name of each file found will be substituted and the backslash-
semicolon marks the end of the command to execute.
You can do this with grep. grep -n 'search-term' *.c
will give you the filename and line number where the term appears.