rubyでkeyの行の置き換え
f=open("test1.txt"); a=Hash.new(); f.readlines.each{|i| i.chomp!; j=i.split(" ") a[j[0]+" "+j[1]]=i; # puts i; } f2=open("test2.txt"); f2.readlines.each{|i| i.chomp! j=i.split(" ") if a.has_key?(j[0]+" "+j[1]) then puts a[j[0]+" "+j[1]]; else puts i; end }