From: "Aravind K." Date: 2012-08-24T17:22:48+09:00 Subject: Add a line into a file at multiple locations above a existing line Hi All, I am working a ruby code to append lines to a existing file at some specified location. I do that by finding a particular string and append the line below that. In a certain case i am trying to add a particular line say welcome before a existing line, Eg. line1 line 2 line3 ) line4 I will need to add the line above line 4 as i cant append it after ) as there may be several )'s. What is the way that i can do this? It would be of great help. Thanks in advance. -- Posted via http://www.ruby-forum.com/.