help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HashCommentLinesMatching


From: Akop Pogosian
Subject: Re: HashCommentLinesMatching
Date: Mon, 31 Mar 2003 14:17:21 -0800
User-agent: Mutt/1.4i

On Mon, Mar 31, 2003 at 12:40:17PM +0200, Mark Burgess wrote:
> On 31 Mar, Akop Pogosian wrote:
> > On Fri, Mar 28, 2003 at 11:05:34PM +0100, address@hidden wrote:
> >> 
> >> Can't you just negate the regular expression?
> >> 
> > 
> > Oh, there is a way to do that? How?
> > 
> > 
> > -akop
> 
> See POSIX regular expressions. The ^ symbol negates...but it depends
> on what you're after. See documentation, or
> 


As someone else has pointed out, the ^ symbol only negates character
classes. I think it's a bit painful to use it to negate more complex
regular expressions. One useful thing that you can do with perl, grep,
or awk is to say "match anything that doesn't match this regular
expression". For example, I have been wondering how to hash comment
every line in /etc/inet/inetd.conf that doesn't match this regular
expression:

^(printer|finger|talk|ident|walld|rstatd|rusersd).*

Someone suggested in this thread to hash comment all lines first and
then enable only some but I think that would end up editing the file
every time cfengine runs. I'd prefer not to edit this file unless it
needs to be edited. There is no really need to extend the regular
expressions syntax to accommodate this functionality. We just need a
few cfengine commands to negate the whole regular expression. That's
why I suggested that we perhaps need a HashCommentLinesNotMatching
keyword. To make this more general, it would be nice for if keyword
that had "Matching" in it had a corresponding "NotMatching" equivalent
or maybe some other way to do this.


-akop





reply via email to

[Prev in Thread] Current Thread [Next in Thread]