summaryrefslogtreecommitdiff
path: root/filter-len
blob: fe45b579aafdb9eec13bdaf2e48564d1606e4b14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env ruby

require 'zipf'

a = ReadFile.new ARGV[0]
b = ReadFile.new ARGV[1]
min = ARGV[2].to_i
max = ARGV[3].to_i

a_out = WriteFile.new ARGV[0]+".out"
b_out = WriteFile.new ARGV[1]+".out"

while line = a.gets
  line1 = b.gets
  len = line.strip.split.size
  len1 = line1.strip.split.size
  if len >= min and len1 >= min and len <= max and len1 <= max
    a_out.write line
    b_out.write line1
  end
end

a.close
b.close
a_out.close
b_out.close