From: "Jesús Gabriel y Galán" Date: 2009-03-06T01:10:02+09:00 Subject: Re: add a new line after, w/txtfile thats comma delimited On Thu, Mar 5, 2009 at 4:58 PM, terminate wrote: > I'm new to Ruby but I just read a book that had an example that is > similar to this.  I've changed the code to see if I can solve this > problem and it seems to do it. > > #code: > > lines = File.readlines("temp.txt") > values = lines.split(/,/) > > output_file = File.open('output.txt', 'w') > values.each do |line| > output_file.puts line > end Just a comment here. It's usually better to use the block form of open, since that will take care of closing the file, even when an error happens: File.open('output.txt','w') do |output_file| #... end Jesus.