All-
Please advise as to how I can delete a line in a file in which a given string appears.
I tried using the delete_if method in the following code, but it failed. (I suspect that delete_if might be an array method rather than a file method. In the code below, "content2" is a file, not an array.)
if FileTest.exist?("input_installs/#{field[5]}" )
install_file = ''
File.open("./input_installs/#{field[5]}") { |f| install_file = f.read }
content2.gsub!(/<install_template.txt>/, install_file)
content2.delete_if { |l| l =~ "uncompress" }
else
(blah blah...)
For the present, I'd prefer to avoid using arrays, so I need a way to search a file and delete any line in which a certain string (eg "uncompress") occurs.
Thanks!
-Kurt