## -*- Ruby -*- ## durch
ersetzen def filesed!(pattern, replaceString, filename) regexPattern = Regexp.compile(pattern) tmpFilename = "#{filename}.#{Time.now.usec}" tmpFile = File.new(tmpFilename, "w") srcFile = File.open(filename) srcFile.each_line do |line| tmpFile.print line.gsub(regexPattern) {|match| replaceString } end tmpFile.close srcFile .close File.rename(tmpFilename, filename) end ARGV.each { |filename| filesed!("", "
", filename) }