Removing duplicate lines from text file Let's say the text file has duplicate lines.

Bob is in this line
Sally is in this line
Bob is in this line
Jason is in this line
Pete is in this line

How would I go about removing the duplicate lines of Bob in line #1 and #3 without knowing the contents/name to look for in that line? Would I need to read the file into memory into an array and use the .uniq! method? Or is there a way to do it with readlines?  I was thinking of trying of read the text file contents into an array, find the duplicates, and leave them in the array. Then 

read_file = File.new('C:\\test\\testduplicate.txt', "r").read
write_file = File.new('C:\\utilities\\noduplicates.txt', "w")
read_file.each_line do |line|
  write_line = true
  duplicates.each do |dup|
  write_line = false if line.include?(dup)
  end
  write_file.write(line) if write_line
end

