Hi all,
if I take this code.
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
it all works fine but if I do it like this
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"
if line =~ /YOUR_REGEX12/
out.puts "THE NEW LINE12"
end
end
end
end
It will only trigger on the first if statment.
I am trying to add say 10 different triggers and add a new line after
that.
Regards
/Fox
--
Posted via http://www.ruby-forum.com/.