diff options
author | Patrick Simianer <p@simianer.de> | 2017-12-03 14:51:01 +0100 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2017-12-03 14:51:01 +0100 |
commit | ca5af986d1148276b5a69aae10e3bae1b4d9dd04 (patch) | |
tree | 896934b13455d5db3c5c1b6baa6897261c96b8d2 | |
parent | 62876ca337fc60c0ecba3556a911eb7fc44f7bf0 (diff) |
filter-len
-rwxr-xr-x | filter-len | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/filter-len b/filter-len new file mode 100755 index 0000000..c1ec9c1 --- /dev/null +++ b/filter-len @@ -0,0 +1,24 @@ +#!/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 + |