I'm trying to search a substantial C++ codebase for a single line that is outputing text to the terminal that I'd like to suppress. I have grepped for std::cout and have had around 40 different files returned. The problems I face are:
- I did not add this myself so I have no idea where it is.
- It is a pointer only outputing memory location so I have no context in which to search for it.
- The codebase is enourmous and contains a great many other instances of
sdt::coutthat have once been used for debugging purposes and have since been commented out.
My question pertains to the last one. I am using
grep -rle 'std::cout' .
to search, which will return positive for instances of std::cout, //std::cout, // std::cout and any other occurence of std::cout sitting on a line that is actually commented out.
How can I modify my grep to omit any line containing // so I can eliminate the commented lines?

-l:grep -re 'std::cout' | grep -v '//'. – Tim N Sep 30 '11 at 14:37std::cout << p; // just debug data– Tim N Sep 30 '11 at 14:38sdt::coutthat have once been used for debugging purposes and have since been commented out." This is why you create a separate function for logging debugs and use a define to enable/disable it. – Ignacio Vazquez-Abrams Sep 30 '11 at 15:16