I am grepping through some VB source files. I use the following query -
grep -nr "GlobalCommArea\s*=\s*.*\.Transaction" .
Some of the lines, however, are commented and begin with a single line comment. A single line comment in VB starts with a single quote - '
Unfortunately, I cannot simply remove all those lines that have a single quote in them, because some of the lines have a single quote comment after the line of code.
So I tried something like this to remove the single quote at the start of the line
grep -nr "GlobalCommArea\s*=\s*.*\.Transaction" . | grep -v "^\s*'"
However, this did not work. How to do this?