[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 <Pine.GSO.4.21.0010111137570.19210-100000@oz>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
- usage question, Ian McNish, 2000/10/11
- Re: usage question,
James Neal - HandiCAT <=