From c14ba05de38f77ca2465c989b5e055a8f24f1d45 Mon Sep 17 00:00:00 2001
From: Patrick Simianer <p@simianer.de>
Date: Sun, 21 Sep 2014 14:14:14 +0100
Subject: add select

---
 select | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100755 select

diff --git a/select b/select
new file mode 100755
index 0000000..9b1eaa8
--- /dev/null
+++ b/select
@@ -0,0 +1,18 @@
+#!/usr/bin/env ruby
+
+require 'trollop'
+require 'zipf'
+
+opts = Trollop::options do
+  banner "sample --index <n> [--shuffle] [--file <line separated data>]"
+  opt :file, "Input file.", :type => :string, :default => '-'
+  opt :index, "Index file.", :type => :string, :required => true
+end
+
+input = ReadFile.readlines_strip opts[:file]
+index = ReadFile.readlines_strip(opts[:index]).map{ |i| i.to_i }
+
+index.each { |i|
+  puts input[i]
+}
+
-- 
cgit v1.2.3