help-cfengine
[Top][All Lists]
Advanced

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

Editfiles DeleteLines Commands


From: Brian E. Seppanen
Subject: Editfiles DeleteLines Commands
Date: Fri, 4 Apr 2003 15:19:07 -0500 (EST)

Hi Folks:

I'm using cfengine-2.0.4 and cfengine-2.0.5 with solaris 8 and I have the 
following definition

        { /etc/test
                DeleteLinesMatching "   only_from       \+="
                LocateLineMatching "    only_from       = 192\.168\.0\.0/24"
                IncrementPointer "1"
                BeginGroupIfNoMatch "   only_from       \+= 10\.10\.10\.0/24
                        IncrementPointer "-1"
                        InsertLine "    only_from       += 10.10.10.0/24
                EndGroup
        }

I want to clear the line everytime that is as follows

        only_from       += 

To insure that I don't have a line who's definition is different from what 
I expect it to be.  If there is no identical match it will append the 
line causing duplicate entries. 

unfortunately I want to do a wildcard match with DeleteLinesMatching as I 
can't expect to always know explicitly everything contained on that line.

I've tried DeleteLinesMatching DeleteLinesStarting and 
DeleteLinesContaining.   None of them work.

Here's what I get currently
cfengine:host:in/cfagent -f /: cfengine:host:in/cfagent -v -: Begin 
editing /etc/test
cfengine:host:in/cfagent -f /: cfengine:host:in/cfagent -v -: Edit: 
Search ended at line 6
cfengine:host:in/cfagent -f /: cfengine:host:in/cfagent -v -: Edit: 
(Found  only_from       = 192.168.0.0/24)
cfengine:host:in/cfagent -f /: cfengine:host:in/cfagent -v -: 
incrementing line pointer to line 7
cfengine:host:in/cfagent -f /: cfengine:host:in/cfagent -v -: (Begin 
Group - skipping       only_from       \+= 10\.10\.10\.0/24 )
cfengine:host:in/cfagent -f /: cfengine:host:in/cfagent -v -: End 
editing /etc/test

I've tried moving the DeleteLinesMatching within the Group definition and 
still no luck.   I've tried the DeleteLinesMatching with an asterisk to 
hopefully match everything after the only_from +=, but that didn't work 
either... 

I would really appreciate it if someone knows how I could fix this so that 
it edits the file properly.

Thank you,


Brian Seppanen
seppy@chartermi.net
906-228-4226 ext 23





reply via email to

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