how to grep for 'vector' but not 'std::vector'
I've spotted a using namespace std; in a common header in our code, and I
want to remove it.
Consequently, I need to replace all occurrences of vector in my code with
std::vector.
I need to write an expression to grep it, that ignores the following cases:
std::vector
// comment with a vector
"string with a vector"
so that I don't end up replacing them like
std::std::vector
// comment with a std::vector
"string with a std::vector"
So far, I've managed to ignore the ''std::vector'' case using the expression
grep "^[^:]*vector" *.h
But I have problems composing negations, like:
find "X" but not "YX" nor "Y.*X"
can anybody help ?
No comments:
Post a Comment