Sort of similar to this question, I need to print all printf's inside multiple c files. The printf's can be multilined, and there can be multiple printf's per file. I'd prefer to not print any leading/trailing comments on the line... So for example, If I have the following file:
// do not print this
rc = printf("blah");
//do not print this
rc = printf("a multiline printf %d %d",
1, 2);
//do not print this
Should output:
printf("blah");
printf("a multiline printf %d %d",
1, 2);
I'll assume that the printf does not have any ;
character in the format string, thus this would be -- find printf
string, print until ;
found, repeat... Is there a simple way to do this in awk/sed?