Skip to content

Instantly share code, notes, and snippets.

@yasuflatland-lf
Last active October 7, 2021 02:14
Show Gist options
  • Save yasuflatland-lf/3a88cee49027bf5f77beca68144c5432 to your computer and use it in GitHub Desktop.
Save yasuflatland-lf/3a88cee49027bf5f77beca68144c5432 to your computer and use it in GitHub Desktop.
Get rid of duplication from 2 files
input = []
File.foreach("input.txt"){|line|
input << line.chomp
}
output = []
File.foreach("output.txt"){|line|
output << line.chomp
}
// Remove duplicated entries in input from output
result = input - output
File.open("result.txt", "w") do |f|
result.each { |s| f.puts(s) }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment