From 2b1d7f881c19c4d4b5afae194e02d3300c7675d0 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Tue, 5 Jul 2016 11:01:46 +0200 Subject: mv --- split_pipes | 51 --------------------------------------------------- 1 file changed, 51 deletions(-) delete mode 100755 split_pipes (limited to 'split_pipes') diff --git a/split_pipes b/split_pipes deleted file mode 100755 index ce8f018..0000000 --- a/split_pipes +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env ruby - -require 'trollop' - -STDIN.set_encoding 'utf-8' -STDOUT.set_encoding 'utf-8' - -conf = Trollop::options do - banner "splitpipes -f < " - opt :field, "field", :type => :int, :required => true - opt :to, "to", :type => :int, :default => nil -end - - -a = [] -range = false -if conf[:to] - range = true -end - -if range - if conf[:field] >= conf[:to] - STDERR.write "field >= to, exiting\n" - exit - end -end - -if conf[:field]<=0 || (range && conf[:to]<=0) - STDERR.write "field or to <= 0, exiting" - exit -end - -while line = STDIN.gets - j = 1 - line.strip.split(' ||| ').each { |i| - if range && (conf[:field]..conf[:to]).include?(j) - a << i.strip - elsif j == conf[:field] - puts i.strip - break - end - j += 1 - } - if range - puts "#{a.join " ||| "}\n" - end - a.clear -end - - - -- cgit v1.2.3