#!/usr/bin/env ruby # Author:: Nicolas Pouillard . # Copyright:: Copyright (c) 2005 Uttk team. All rights reserved. # License:: LGPL # $Id: /fey/uttk/trunk/misc/expandtab.rb 8784 2005-09-26T12:11:55.049358Z ertai $ class String def process! chomp! gsub!(/\t/, ' ') self end end if ARGV.empty? STDIN.each do |line| puts line.process! end else ARGV.each do |file| puts "Processing: #{file}..." File.open("#{file}.tmp", 'w') do |tmp| IO.foreach(file) do |line| tmp.puts line.process! end end File.rename("#{file}.tmp", file) end end