acatfile, rcatfile, filter, centre = ARGV adb = {} puts "loading #{acatfile}" File.open(acatfile, 'r') {|fp| for line in fp row = line.split(/\t/, 3) ahl = sprintf('%-6s %4s', row[0], row[1]) adb[ahl] = true end } rfilter = Regexp.new(filter) ok = 0 ng = [] puts "scanning #{rcatfile} filter #{filter} search #{centre}" File.open(rcatfile, 'r') {|fp| for line in fp row = line.sub(/^"/, '').sub(/"\r?\n$/, '').split(/","/) next unless rfilter === row.first next unless row[2..-1].include?(centre) if adb[row.first] then ok = ok.succ else ng.push row.first end end } puts "ok #{ok} ng #{ng.size}" for ahl in ng.sort puts ahl end exit(ng.empty? ? 0 : 1)