[Novalug] need grep help

Peter Larsen plarsen@famlarsen.homelinux.com
Thu Mar 15 19:48:44 EDT 2012


you just need to turn on regular expressions:

egrep -v "^#" filname | less



Sent from my ASUS Eee Pad

Jay Hart <jhart@kevla.org> wrote:

>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
>
>_______________________________________________
>Novalug mailing list
>Novalug@calypso.tux.org
>http://calypso.tux.org/mailman/listinfo/novalug


More information about the Novalug mailing list