From: James Dinkel Date: 2008-06-22T13:16:41+09:00 Subject: changing a file inline on Windows Here is my current method for editing files: filename = File.join('path', 'to', 'file') content = [] File.open(filename, 'r') do |file| content = file.readlines end content.collect! do |line| line.gsub!(/six/, "half a dozen") line.chomp end File.open(filename, 'w') do |file| file.write content.join($/) end This is expensive though, as it rewrites the entire file, even if only a single word in the whole file is changed. I'm wondering if there is a better way to do this. James -- Posted via http://www.ruby-forum.com/.