Thanks, Neil!

But I'm still having problems.  What is replace_last() in your example?  Do
you have this define in a custom.cf ?? Here's what I get:

Undeclared promise body "replace_last()" was referenced in a promise
No such FnCall "replace_last()" in promise @ ./cfagent.testservice.conf near
line 16

 I tried to replace with value() but that doesn't work.

Any help is appreciated!!

Thanks,

deb

On Fri, Apr 29, 2011 at 11:17 AM, <no-re...@cfengine.com> wrote:

> Forum: Cfengine Help
> Subject: Re: Newbie Needs help with regular expression
> Author: neilhwatson
> Link to topic: https://cfengine.com/forum/read.php?3,21706,21708#msg-21708
>
> Try this.
>
>
> bundle agent foo {
>       files:
>        "/tmp/yourfile"
>                edit_line => search_replace(
> "^ifconfig_lm2=\"up\"\s*",
> "ifconfig_lm2=\"up mtu 9000\""
> );
>
> }
>
> bundle edit_line search_replace(string1, string2) {
>    replace_patterns:
>        "${string1}"
>        replace_with => replace_last("${string2}");
> }
>
>
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@cfengine.org
> https://cfengine.org/mailman/listinfo/help-cfengine
>
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to