From: Max Muermann Date: 2006-08-23T07:03:47+09:00 Subject: Re: file compare and remove lines bad = [] File.read("small.txt").each { |line| bad << line.to_i } good = File.new("good.txt","w"); File.read("big.txt").each do |line| id = line.split('\t')[0].to_i good << line unless bad.delete(id) end good.close I'm sure there's a better way, but this took only two minutes to write. Max On 8/23/06, Matt Coffman wrote: > Here is my issue: > > I have two files - call them big.txt and small.txt. My goal is to have > a list file and remove any lines in the big file that exist. > > Big.txt is a tab del file with the following info > > 11 Fred Flinestone Bedrock,Il > 12 Wilma Flinestone Bedroc, Il > > > small.txt is a tab del file - following information > 12 > 23 > 32 > 23 > > > I would like to scan big.txt against small.txt to get a final file > good.txt - with the following > > 11 Fred Flinestone Bedrock,Il > > > > regards, > > matt > > -- > Posted via http://www.ruby-forum.com/. > >