1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#!/usr/bin/env ruby require 'zipf' accept = {} f = ReadFile.new ARGV[0] f.readlines_strip.each { |line| accept[line.strip.to_i] = true } i = 0 while line = STDIN.gets if accept[i] STDOUT.write line end i += 1 end