help-cfengine
[Top][All Lists]
Advanced

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

Re: ForEachLineIn/ReadArray ??


From: Andy Mace
Subject: Re: ForEachLineIn/ReadArray ??
Date: Fri, 28 Jan 2005 10:49:47 -0000

Hi,

Ok.. I basically have a file with strings on each line
I want to loop around the file and read each string on the line and write a line out in a config file.

Hopefully that makes sense.

Regards
Andy

..Where's that vodka bottle.... ah bugger... its empty.


----- Original Message ----- From: "Tim Nelson" <address@hidden>
To: "Andy Mace" <address@hidden>
Cc: <address@hidden>
Sent: Friday, January 28, 2005 1:10 AM
Subject: Re: ForEachLineIn/ReadArray ??


On Thu, 27 Jan 2005, Andy Mace wrote:

Hi All,

As this is my first post to the list, I will do a little Introduction!:
My Name is Andy Mace. I work for a IT consultancy company located in Chiswick, West London. My Key Skills involve: PHP, MySQL, Object Pascal, Sleeping, Flirting and drinking copious amounts of Alcohol.

We are trying to get a cfengine system set-up and have hit a brickwall.

I am trying to read in a file and loop around the lines to read the contents of the file, I have been trying to use "ForEachLineIn /path/to/file" but cannot find a way to get the contents of the line.

I know about ReadArray but can't see how to use it within an editfile section.
Any help would be much appriciated.

1. Try varying the amount of alcohol until a solution appears :).
2. While editfiles is a great tool, it can't do everything
3. Try telling us what you're trying to achieve in terms of what
 edits you want to make, rather than the more specific item you
 gave us (which doesn't have quite enough context).

I've used editfiles som (having written a total of maybe 50-100 lines of editfiles over the years), and I've never needed to read in a file like one does in Perl (et. al.). cfengine often sort of reads things in automatically. For example, I can often do the stuff I want by using a combination of LocateLineMatching, ReplaceLineWith, and CatchAbort (although I've used about 20 of the other editfiles commands too).

 :)

--
Tim Nelson
Server Administrator
WebAlive Technologies Global
Level 1 Innovation Building, Digital Harbour
1010 LaTrobe Street
Docklands, Melbourne, Vic, 3008
Phone: +61 3 9934 0812
Fax: +61 3 9934 0899
E-mail: address@hidden
http://www.webalive.biz/

"Your Business, Your Web, Your Control"







reply via email to

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