extracting function headers in a c/c++ file using shell script

Hi,
Is there any way to extract function headers from c and c++ files using a shell script? I tried to do it by reading the C/C++ file line by line and if a line matches a particular pattern (pattern of function header) i extracted it otherwise moved to next line. The problem here is, some function headers are more than one line length ie the return type is in first line, function name in second line and parameters are in the following lines. My script is not identifying these functions :frowning:

Thanks,
Priya.

Try extracting them only in prototype.

My aim to find the number of functions differ from 2 versions of a file.

First i tried to use diff command. this 'll list the functions with either + or -follwed by the function's name. This command identifies one line function headers only. I've to get the funtions with header in more than one line as well. Can anyone help me in this aspect?

diff -u $i $j | grep ^[+-][a-zA-Z] >> diff_func__"$p"__"$q".txt

Thanks.
Priya.

You may want to use regular expressions that match multi-line patterns rather than single-line.

tyler_durden