The description you have provided is a little sparse. If this is C or C++ code, the following two options might help:
- For the example shown, you could search for lines starting with arbitrary whitespace followed by printf( as the start line and continue to the next line ending with ); followed by arbitrary whitespace.
- If you're in vi at the start of the line containing printf you could use the % command to find the ending ) (assuming that the format string and any string constants being printed don't contain any mismatched parentheses).
If you're not already inside an editor making changes to your source code, you could use
ed,
ex,
sed, or
awk, to make similar changes (assuming you want to comment out ALL
printf statements or only want to comment out
printf statements with a specific format string).
But, if this is
awk code (where the trailing semicolon is optional and in come cases the parentheses are also optional), different rules would be needed.