Skip to content

Instantly share code, notes, and snippets.

@o-sam-o
Created May 18, 2011 05:14
Show Gist options
  • Save o-sam-o/978031 to your computer and use it in GitHub Desktop.
Save o-sam-o/978031 to your computer and use it in GitHub Desktop.
Remove duplicate lines in a text file
list = []
File.open("list.txt", "r") do |infile|
while (line = infile.gets)
list << line.strip
end
end
list.uniq.each do |l|
p l
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment