[Top][All Lists]

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

edit xml config files whith cfengine

From: Uli Knauss
Subject: edit xml config files whith cfengine
Date: 14 May 2004 09:09:25 -0700


I have to check and edit many xml-Files with cfengine. 
The xml-Files looks like this example:

<< -- snipp -- >>
<< -- snapp -- >>

For example: I have to change/check the value "<use>  </use>" to
"false" but only in datasource "<id>foo01</id>", not in
"<id>foo02</id>" or on other places in the file.

My solution for now is first to search for "<datasource>". After this
I search for "<id>foo01</id>" and then I look for "<use>...</use>" and
change the line regardless if the line is correct or not. This looks
in the cfengine program like this:

<< -- snipp -- >>

       { /tmp/foo.xml
         LocateLineMatching '.*<datasource>'
         LocateLineMatching '.*<id>foo01<\/id>'
         LocateLineMatching '.*<use>.*<\/use>'
         ReplaceLineWith '<use>false</use>'
<< -- snapp -- >>

May be somebody have a better idea or a shorter solution to edit
xml-files. Is there a facilty to edit XML-Files in a proper way?

Thanks for any hints

reply via email to

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