ruby で書き直した。
#!/usr/bin/ruby
require 'pp'
raise "no argments." unless ARGV[0]
open(ENV["HREF_DATADIR"]+"/comptable",'r') {|file|
while line = file.gets
print (line[line.index(',')+1...line.size].chop).chomp,"\n" if line.include? ARGV[0]
end
}
っていうか、hrefにはじめから検索機能あった。正直かなりショックだった。