[Novalug] need grep help
Jay Hart
jhart at kevla.org
Thu Mar 15 19:44:37 EDT 2012
I like to search config files with the comment lines removed. So I thought
more filename | grep -v "#"
would remove any line starting with a "#" character
However it seems to actually remove any line with a "#" on the line,
regardless of placement (or something similar to this behavior).
I've seen some examples online to remove lines if the first char is a #, but
not for example if the line is indented, but still a comment.
What I'm really looking for is a grep that will remove all comment lines, or
lines that are blank.
This:
grep -v '^$' filename |grep -v "#"
doesn't quite get me there.
Can I get some pointers on this.
Jay
More information about the Novalug
mailing list