#!/usr/bin/env ruby options = { :remove => "", } ARGV.reject!{|arg| if arg =~ /--([^=]+)=?/ then options[$1.to_sym] = $' || true true else false end } if ARGV.size < 1 then puts "#{__FILE__} (log.dat)" exit(-1) end src_fname = ARGV.shift dst_fname = options[:out] || "#{File::basename(src_fname, '.*')}.removed.dat" $stderr.puts "#{src_fname} => #{dst_fname}" open(dst_fname, 'w'){|dst_io| open(src_fname){|src_io| while page = src_io.read(32) if options[:remove].include?(page[0]) then next end dst_io << page end } }