help-cfengine
[Top][All Lists]
Advanced

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

Re: usage question


From: James Neal - HandiCAT
Subject: Re: usage question
Date: Wed, 11 Oct 2000 12:53:05 -0700

In message <address@hidden>you write:
>LocateLineMatching "*hey there buddy:*"
>CommentNLines "2"
>
>
>which gives the error:
>
>cfengine:jump04: Regular expression error for *hey there buddy:*
>cfengine:jump04: regcomp: No such file or directory
>cfengine:jump04: LocateLineMatchingRegexp failed in /tmp/billy, aborting editi
>ng
>cfengine:jump04: End editing /tmp/billy

I'm guessing your problem is with the regex.  It looks like you're
trying to use globs instead of regexes.  In order to match that string,
you'll want something like this:

LocateLineMatching ".*hey there buddy:.*"
CommentNLines "2"

In regex-speak, "." means "match any character" and "*" means "match
zero or more of the previous character".  Basically, regex ".*" is
eqivilant to glob "*".

If there's a chance that those lines might not be in the file at all,
you'll want to wrap a "BeginGroupIfLineMatching '.*hey there buddy:.*'"
"EndGroup" around those lines above.  "LocateLineMatching" will abort
editing of the file if no match is found.

-James



reply via email to

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