From: Jason Date: 2001-02-04T11:10:02+09:00 Subject: [ruby-talk:10330] Efficiency Check Hi All, Below is a directory wide (or file wide, depending on your preference) search and replace method, written in Ruby. Just so I know I'm on the right track, is that the quickest way to write the application (ie, is there a shortcut around creating an object named aFile, and then writing to the file? def sr(searchString, replaceString, fileName) if File.stat(fileName).file? aFile = File.open(fileName, "r").read.gsub(searchString, replaceString) File.open(fileName, "w").print(aFile) end end (ARGV.length - 2).times { |i| sr(ARGV[0], ARGV[1], ARGV[2+i])} Jason Sent via Deja.com http://www.deja.com/