If I understand the problem, you want to find all files beneath a directory which contain a certain string, except ignoring the string when it falls in a comment block. Here's a solution that uses perl:
find . -type f -print0 | while read -d $'\0' f; do if perl -0777pe 's| +/\*.*?\*/||gs' $f | grep certain_string >/dev/null; then echo $f; fi +; done
Aaron B.
Available for small or large Perl jobs and *nix system administration; see my home node.
In reply to Re^3: How do i search and extract commented lines from a file using perl?
by aaron_baugher
in thread How do i search and extract commented lines from a file using perl?
by sravan937
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |