[Novalug] need grep help

John Holland jbholland at gmail.com
Fri Mar 16 16:51:53 EDT 2012


On 3/16/12 5:42 PM, James Ewing Cottrell 3rd wrote:
>
> Now that I think of it, perhaps this is best: "^[ \t]*(#|$)" in other
> words
>
> "Possible initial whitespace followed by either # or nothing else"
>
> I think we have a winner!
>
> JIM

Kevin's original was  "^[[:space:]]*(#.*)?$"
comparing them it looks to me like the [[:space]] vs [ \t] is cosmetic,
but the
part after the ( is not - your new one is cleaner. It seems to work from
a quick check.

changed my .bash_profile to use ^[ \t]*(#|$) 

hopefully it'll stay that way......

John

On 3/16/12 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:]]*(#.*)?$" '

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://calypso.tux.org/pipermail/novalug/attachments/20120316/97d7d3db/attachment.html 


More information about the Novalug mailing list