|
From: | Chip Seraphine |
Subject: | Re: Feature Request: DeleteLinesNotMatching |
Date: | Wed, 01 Oct 2003 08:12:45 -0500 |
User-agent: | Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.2.1) Gecko/20030121 |
Daniel Pittman wrote:
One of the common problems that I am having with the cfengine 'editfiles' operation is to make sure that something that isn't permitted in a file is removed. This would be made much easier by having a 'DeleteLinesNotMatching <regexp>' operation available. Any thoughts on this for a future version? Daniel
Almost all (or maybe just 'all') of the 'one-sided' logical editfiles actions could use a mirror action, IMHO. BeginGroupIfLineMatching would be huge, too....
I've generally gotten by such things by either writing a module to do it in perl/awk/shell/whatever or using a kludgey (but faster) trick such as "ReplaceAll x With y" to get the file in a state that can be managed with the available tools. Be warned, though, cfengine will sometimes tell you that such things are not convergent, even when it is apparent (to a human) that they are. This has happened to me when doing things like converting tabs to spaces so that I could use SplitOn stuff...
[Prev in Thread] | Current Thread | [Next in Thread] |