diff options
author | Patrick Simianer <p@simianer.de> | 2014-09-21 14:14:14 +0100 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2014-09-21 14:14:14 +0100 |
commit | c14ba05de38f77ca2465c989b5e055a8f24f1d45 (patch) | |
tree | 73cd026c8a85a79e6ff8261be9cf033be49dbea3 /select | |
parent | 98da2a419ad77ed0aa0128f1c3074c512f466e24 (diff) |
add select
Diffstat (limited to 'select')
-rwxr-xr-x | select | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -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] +} + |