From: "Jesús Gabriel y Galán" Date: 2012-04-17T16:32:39+09:00 Subject: Re: insert text after line "whatever" On Mon, Apr 16, 2012 at 9:09 PM, fox foxmaster wrote: > Hi all, > > Does anyone have a solution on how to either see the problems with the > above code or a solution on how to do it with reading line by line and > inserting the text after a specific line? Something like this should work: File.open("destination.txt", "w") do |out| File.foreach("original.txt") do |line| out.puts line if line =~ /YOUR_REGEX/ out.puts "THE NEW LINE" end end end Jesus.