summaryrefslogtreecommitdiff
path: root/dtrain/hstreaming/rule_count/rulecount.rb
blob: 67361fa43d73ac615991829e8eeaa3f4ca70fbf2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/env ruby

STDIN.set_encoding 'utf-8'
STDOUT.set_encoding 'utf-8'

while line = STDIN.gets
  a = line.strip.chomp.split "\t"
  a[3..a.size].each { |r|
    id = r.split("|||")[0..2].join("|||").to_s.strip.gsub("\s", "_")
    puts "#{id}\t1"
  }
end