[Novalug] need grep help

James Ewing Cottrell 3rd JECottrell3 at Comcast.NET
Fri Mar 16 16:12:53 EDT 2012


Cleverness Kudos for combining the two RE's into one, but Performance 
Dings for not keeping them separare.

For all comments, the ".*" part will have to be scanned unnecessarily.

I still say that '^$|[ \t]#' is better, and more clear.

Besides...what happens when you want to add other types of comments? 
Bind files use ';'. C++ and others use '//'.

JIM

P.S. I won't even mention the [[:space:]] abomination.

On 3/16/2012 11:22 AM, Kevin Cole wrote:
> On Thu, Mar 15, 2012 at 20:00, Kevin Cole <dc.loco at gmail.com 
> <mailto:dc.loco at gmail.com>> wrote:
>
>
>         Been there, done that.  So often in fact that I add this alias
>         to my .bash_aliases wherever I go:
>
>         alias decomment='egrep -v "^[[:space:]]*(#.*)?$" '
>
>
>     P.S. The pseudo-English translation of that is (sort of) "search
>     for lines that do not begin with zero or more spaces followed by
>     at least one occurance of zero or more hash marks, with nothing
>     else until the end of the line".
>
>
> Correction: The code is good. The psuedo-English is bad: It should 
> read something like "search for lines that do not match  zero or more 
> spaces at the begining of a line, followed by zero or one occurances 
> of (a hash mark followed by any characters), followed by the end of 
> the line". Still unreadable in English, but at least more accurate.
>
>
> _______________________________________________
> 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/20120316/1b47a852/attachment.html 


More information about the Novalug mailing list