Skip to content

Instantly share code, notes, and snippets.

@kylemclaren
Forked from rymawby/compare_lines.rb
Created March 20, 2014 10:25
Show Gist options
  • Save kylemclaren/9660938 to your computer and use it in GitHub Desktop.
Save kylemclaren/9660938 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
# script to compare and see what lines are in file1 but not file2
f1 = File.open('file1.txt')
f2 = File.open('file2.txt')
file1lines = f1.readlines
file2lines = f2.readlines
file1lines.each do |e|
if(!file2lines.include?(e))
 puts e
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment