[Top][All Lists]

[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: Thu, 04 Dec 2003 09:53:52 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030905

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 commande 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:

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 ""

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:  

reply via email to

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