From: terminate Date: 2009-03-06T00:58:34+09:00 Subject: Re: add a new line after, w/txtfile thats comma delimited 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 result should be: value1 value2 value3 value4 On Mar 5, 10:07 am, Mmcolli00 Mom wrote: > How do you add a new line after you have split a text file with > continuous values delimited with commas? Thanks in advance. MC > > For example: > textfile contains: value1,value2,value3.. > > I want to output this file like this: > value1 > value2 > value3 > > #Here is my code: > > File.open('temp.txt', 'r') do |temp| >      arraym = [] #<--I am using array so that I can use array functions > .but I dont have to use array for this >       temp.each_line do |line| >          arraym=  line.split(",",0) >          b.puts "" >          b.puts arraym # + "\n" >          b.puts "" >       end >  end > -- > Posted viahttp://www.ruby-forum.com/.