#!/usr/bin/env ruby require 'zipf' a = ReadFile.new ARGV[0] b = ReadFile.new ARGV[1] max = ARGV[2].to_i a_out = WriteFile.new ARGV[0]+".out" b_out = WriteFile.new ARGV[1]+".out" while line = a.gets line1 = b.gets if line.strip.split.size <= max and line1.strip.split.size <= max a_out.write line b_out.write line1 end end a.close b.close a_out.close b_out.close