From: Shane Emmons Date: 2008-11-22T06:58:34+09:00 Subject: Re: append new line to textfile ------=_Part_37384_33455253.1227304958359 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Fri, Nov 21, 2008 at 4:41 PM, Mmcolli00 Mom wrote: > I want to create a text file and append a new line to the text file > everytime a new logline is completed, my program iterates and gives a > new log every few hours. > > this is an example of my logline: > logline: 'completed' starttime 04:00 endtime 23:00 > > my goal is to have a text file populated with the following > 'completed' starttime 04:00 endtime 22:00 > 'completed' starttime 06:00 endtime 01:00 > 'completed' starttime 05:00 endtime 23:00 > 'completed' starttime 09:00 endtime 23:00 > > so far this is my method...yes, I am a beginner. Thanks in advance. MC > > File.open('logfile.txt')do |f1| > f1.logline > end > -- > Posted via http://www.ruby-forum.com/. > > File.open('logfile.txt', 'w+') do |f1| f1.write(logline) end -- Shane Emmons ------=_Part_37384_33455253.1227304958359--