help-cfengine
[Top][All Lists]
Advanced

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

[Re: Does a standalone editfiles command tool exist?]


From: Hans Deragon
Subject: [Re: Does a standalone editfiles command tool exist?]
Date: Fri, 05 Dec 2003 11:30:39 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030905

Hi again.


Since nobody answered to my challenge, I assume that there is no easier way to edit a file using the action/section EditFiles of cfengine, right? To bad its not made into a standalone command line tool. I believe such a tool would be very popular. If I had the time, I would rip it out.


Best regards,
Hans Deragon
--
Consultant en informatique/Software Consultant
Deragon Informatique inc.         Open source:
http://www.deragon.biz            http://swtmvcwrapper.sourceforge.net
mailto://hans@deragon.biz         http://autopoweroff.sourceforge.net

-------- Original Message --------

Pete Ehlke wrote:
On Tue, Dec 02, 2003 at 12:42:41PM -0500, Hans Deragon wrote:

One of the best features of cfengine is its editfiles action/section. Did anybody every rip this out of cfengine and made a standalone command line tool just to edit files? Or is there any other command tool with simillar functionnality to editfiles that exist out there?


I believe you want this:

http://www.oreilly.com/catalog/sed2/

Ok, I am not very familiar with sed and awk, but as far as I know, these
programs are line oriented.

How can I write a script that would perform something like the following and
would remain as elegant?

      BeginGroupIfNoLineMatching "# Addition by EMC ended."
        LocateLineMatching ".*. /etc/init.d/functions.*"
        IncrementPointer   "-3"
        InsertLine "# Addition by EMC started."
        InsertLine 'DHCP_HOSTNAME=${dollar}{HOSTNAME}'
        InsertLine "# Addition by EMC ended."
        InsertLine ""
      EndGroup

Off course, this can be done, but I do not know of any scripting tool that
allows one to express the above changes so elegantly.  Anybody can translate
this into sed/awk in about the same number of lines?


Best regards,
Hans Deragon
--
Consultant en informatique/Software Consultant
Deragon Informatique inc.         Open source:
http://www.deragon.biz            http://swtmvcwrapper.sourceforge.net
mailto://hans@deragon.biz         http://autopoweroff.sourceforge.net



_______________________________________________
Help-cfengine mailing list
Help-cfengine@gnu.org
http://mail.gnu.org/mailman/listinfo/help-cfengine





reply via email to

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