From: Chris Daves Date: 2007-12-13T11:16:59+09:00 Subject: Re: read in file Junyoung Kim wrote: > Chris Daves wrote: >> Hi, >> I've created a simple program which will read in a file. >> # >> >> class Reference >> references = 'C:\Documents and Settings\Chris >> Davies\Desktop\References.rb' >> >> f = File.open(references, 'r') >> file_data = f.read >> f.close >> >> >> >> puts file_data >> end >> # >> >> but i want to take this file data and interpret each line of data and >> the put each line into a new file line by line. >> >> cheers > > File.open("path/your/file") do |sFile| > while sLine = sFile.gets > puts YouCanSeeYourData > end > end cheers for that, but how can i take that data and move it into a new file line by line? i just want to move exactly the same data from an existing file to a new file. cheers -- Posted via http://www.ruby-forum.com/.