[Novalug] need grep help

John Holland jbholland at gmail.com
Thu Mar 15 19:54:38 EDT 2012


from a search:


*egrep -v "^[[:space:]]*$|^#"    

but I would say change it to:

*
*cat filename | egrep -v "^[[:space:]]*$|^**[[:space:]]***#"  *| less

seems to work for me........


On 3/15/12 7:44 PM, Jay Hart 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 at calypso.tux.org
> http://calypso.tux.org/mailman/listinfo/novalug

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://calypso.tux.org/pipermail/novalug/attachments/20120315/5be67ed1/attachment.html 


More information about the Novalug mailing list