Skip to content

Instantly share code, notes, and snippets.

@timuruski
Created July 28, 2011 22:25
Show Gist options
  • Select an option

  • Save timuruski/1112720 to your computer and use it in GitHub Desktop.

Select an option

Save timuruski/1112720 to your computer and use it in GitHub Desktop.
names1 = File.readlines('names1.txt').map(&:chomp).map { |line| line.split(',')[-1].strip }
names2 = File.readlines('names2.txt').map(&:chomp).map { |line| line.split(',')[-1].strip }
p names1.map { |name| names2.include?(name) ? name : nil }.compact
p names2.map { |name| names1.include?(name) ? name : nil }.compact
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment