From 2b1d7f881c19c4d4b5afae194e02d3300c7675d0 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Tue, 5 Jul 2016 11:01:46 +0200 Subject: mv --- merge-ttable | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 merge-ttable (limited to 'merge-ttable') diff --git a/merge-ttable b/merge-ttable new file mode 100755 index 0000000..ac10903 --- /dev/null +++ b/merge-ttable @@ -0,0 +1,34 @@ +#!/usr/bin/env ruby + +require 'zipf' +require 'trollop' + +def main + conf = Trollop::options do + opt :f, "f files", :type => :string, :required => true + opt :e, "e files", :type => :string, :required => true + end + + f_files = conf[:f].split + e_files = conf[:e].split + + h = {} + f_files.each_with_index { |fn,i| + fa = ReadFile.readlines_strip fn + ea = ReadFile.readlines_strip e_files[i] + fa.each_with_index { |fw,j| + if h.has_key? fw + h[fw] << ea[j] + else + h[fw] = [ea[j]] + end + } + } + + h.each_pair { |f,ea| + puts "#{f}\t#{ea.first}" + } +end + +main + -- cgit v1.2.3