Sha256: 03e8fefcec76689454aa917237d0ba8485833bda65df3498f9493c7229a20b84
Contents?: true
Size: 1.02 KB
Versions: 709
Compression:
Stored size: 1.02 KB
Contents
#!/usr/bin/env ruby require 'rbbt-util' require 'rbbt/util/simpleopt' $0 = "rbbt #{$previous_commands*""} #{ File.basename(__FILE__) }" if $previous_commands options = SOPT.setup <<EOF Subset entries in a tsv $ rbbt tsv head [options] file.tsv Subsets entries from a TSV file from a given list. Works with Tokyocabinet HDB and BDB as well. -tch--tokyocabinet File is a TC HDB -tcb--tokyocabinet_bd File is a TC BDB -hh--header_hash* Change the character used to mark the header line (defaults to #) -h--help Help EOF SOPT.usage if options[:help] file = ARGV.shift file = STDIN if file == '-' raise ParameterException, "Please specify the tsv file as argument" if file.nil? options[:fields] = options[:fields].split(/,\|/) if options[:fields] options[:header_hash] = options["header_hash"] case when options[:tokyocabinet] tsv = Persist.open_tokyocabinet(file, false) when options[:tokyocabinet_bd] tsv = Persist.open_tokyocabinet(file, false, nil, TokyoCabinet::BDB) else tsv = TSV.open(file, options) end puts tsv.head
Version data entries
709 entries across 709 versions & 1 rubygems