Advertisement
cd62131

find and print

Sep 22nd, 2017
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.25 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2. input = open('input.txt').map {|e| [e.split[0], e] }
  3. open('list.txt').map {|e|
  4.   e.strip!
  5.   ([e] + input.select {|_, li| li.include? e }.map {|id, _| id })
  6.   .join "\t"
  7. }.join("\n").tap {|e| open('output.txt', 'w') {|f| f.puts e } }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement