[Novalug] need grep help
James Ewing Cottrell 3rd
JECottrell3@Comcast.NET
Fri Mar 16 17:23:01 EDT 2012
On 3/16/2012 3:36 PM, John Holland wrote:
> Does \t escape all kinds of whitespace? don't you need some sort of *
> operator after the [\t] ?
Yes, I forgot the *. Kudos.
No, \t is Tab Only. There was also a space before it. Newlines take care
of themselves. Nobody uses \v, and \f is often treated as a newline by
everything but printers.
JIM
>
>
> On 3/16/12 4:12 PM, James Ewing Cottrell 3rd wrote:
>> 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@gmail.com
>>> <mailto:dc.loco@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@calypso.tux.org
>>> http://calypso.tux.org/mailman/listinfo/novalug
>>
>>
>>
>> _______________________________________________
>> Novalug mailing list
>> Novalug@calypso.tux.org
>> http://calypso.tux.org/mailman/listinfo/novalug
>
>
>
> _______________________________________________
> Novalug mailing list
> Novalug@calypso.tux.org
> http://calypso.tux.org/mailman/listinfo/novalug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.firemountain.net/pipermail/novalug/attachments/20120316/733ad029/attachment.htm>
More information about the Novalug
mailing list