On Mon, 14 Mar 2011 10:21:05 -0400 Jesse Becker <becker...@mail.nih.gov> wrote: 

JB> On Mon, Mar 14, 2011 at 10:04:40AM -0400, no-re...@cfengine.com wrote:
>> Forum: Cfengine Help
>> Subject: Re: Weird unset variable warning?
>> Author: sauer
>> Link to topic: https://cfengine.com/forum/read.php?3,21129,21133#msg-21133
>> 
>> Yes, it's a tenatively false error (though I honestly haven't looked
>> to see if it works on the first or second pass).  It just bugs me to
>> have warnings spit out, and I was hoping there was some kind of
>> alternate structure I could use which would avoid the error.
>> 
>> I'm using the find in relation to a message I posted a few days ago;
>> I need to edit a few thousand perl files to ensure that the bang
>> path includes a -U to untaint some suid perl CGI scripts.  The files
>> are between 2 and N levels underneath a directory, and the manual
>> says that I can't do file edits with recursion - and I can't find
>> the "I'm not an idiot I just make questionable decisions" flag. :)
>> Doing the find is only one external call which I can then iterate
>> over with Cfengine, as opposed to using a transform and making a few
>> thousand calls to "sed -i" or whatever.

JB> Perhaps coding it up in Perl (which can do both the recursion and edits
JB> without the overhead of thousands of forks() calls), then having
JB> cfengine commands: promise for it makes sense?

Something like this would work (20 files per Perl invocation here):

find DIRNAME -print0 | xargs -0 -n 20 perl -p -i -e 's/a/b/'

Ted
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to