Skip to content

Instantly share code, notes, and snippets.

@mutle
Created September 16, 2008 13:01
Show Gist options
  • Save mutle/11026 to your computer and use it in GitHub Desktop.
Save mutle/11026 to your computer and use it in GitHub Desktop.
#!/bin/ruby
filename = $*[0]
lines = {}
puts "Comparing #{filename}"
File.open(filename, "r") do |f|
while (line=f.gets) do
line = line.downcase.gsub(/\n/, '')
lines[line] ||= 0
lines[line] += 1
end
end
lines.keys.sort.each do |k|
puts "#{k}: #{lines[k]}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment