Advertisement
cd62131

find and print

Sep 25th, 2017
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.24 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2. input = open('input.txt').to_a
  3. open('list.txt').map {|e|
  4.   e.strip!
  5.   ([e] + input.select {|li| li.include? e }.map {|li| li.split[0] })
  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