help-cfengine
[Top][All Lists]
Advanced

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

Re: Bug in LocateLineMatching?


From: Alexander Mattausch
Subject: Re: Bug in LocateLineMatching?
Date: Mon, 03 Feb 2003 15:10:04 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.2.1) Gecko/20021130

Harald Hannelius schrieb:

The docs say that LocateLineMatching should move the current-position
pointer to the start of the line matching the quoted regular expression.

However, this command;

{ /etc/lilo.conf
               LocateLineMatching "image = /boot/2.4.19"
               BeginGroupIfNoLineContaining "# 3 Feb 03"
                       InsertLine "# 3 Feb 03"
                       InsertLine "image = /boot/2.4.20/bzImage"
                       InsertLine "  label = 2.4.20"
                       InsertLine '  append = "video=matrox:vesa:0x1BB"'
                       InsertLine ''
               EndGroup
       }

I would do it this way:

{ /etc/lilo.conf

 BeginGroupIfNoLineContaining "# 3 Feb 03"
   LocateLineMatching "image = /boot/2.4.19"
   IncrementPointer "-1"
   InsertLine "# 3 Feb 03"
   InsertLine "image = /boot/2.4.20/bzImage"
   InsertLine "  label = 2.4.20"
   InsertLine '  append = "video=matrox:vesa:0x1BB"'
   InsertLine ''
 EndGroup

}

If you want to insert _before_ a line, you need the command IncrementPointer "-1". If you want to replace a line, e.g with ReplaceLineWith, you don't need it. This is just

LocateLineMatching "RegEx"
ReplaceLineWith "bla bla"

Regards,
Alex






reply via email to

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