From: Raveendran Jazzez Date: 2008-05-06T19:50:43+09:00 Subject: Re: take text from file and add do it with Ruby..? Try this one..... full= File.open("orig.txt") phrase=["phrase1","phrase2","phrase3"] count=0 inside=[] full.each do |line| first=[] first=line.split(/\|/) first.each do |single| sub=single.strip! main = (sub).to_s + " "+(phrase [count]).to_s inside << main newfile=File.new("orig2","w") newfile.puts inside newfile.close count+=1 end end Regards, P.Raveendran RailsFactory http://raveendran.wordpress.com -- Posted via http://www.ruby-forum.com/.