-#!/usr/bin/ruby1.9.1
+#!/usr/bin/ruby
# $Id$
#
# Author:: Daigo Moriwaki
#
# Sample Command lines that isntall prerequires will work on Debian.
#
-# * Ruby 1.9.3 or 1.8.7
+# * Ruby 2.0.0 or later
#
-# $ sudo aptitude install ruby1.9.1
+# $ sudo aptitude install ruby
#
# == Run
#
# @parameter file an absolute path of a csa file
#
def grep(file)
- str = File.open(file).read
+ if RUBY_VERSION >= "1.9.1"
+ str = File.open(file, "r:EUC-JP").read
+ else
+ str = File.open(file, "r").read
+ end
if /^N\+(.*)$/ =~ str then black_name = $1.strip end
if /^N\-(.*)$/ =~ str then white_name = $1.strip end
puts [time, state, black_mark, black_id, white_id, white_mark, file].join("\t")
end
end
+ $stdout.flush
end
# Show Usage