Sha256: ea9b933e74798f655148745a4d01b76195ade163db3c39b473708a425de9ba02

Contents?: true

Size: 775 Bytes

Versions: 37

Compression:

Stored size: 775 Bytes

Contents

#!/usr/bin/env ruby

require 'rbbt-util'
require 'rbbt/util/simpleopt'

options = SOPT.get("-tch--tokyocabinet:-tcb--tokyocabinet_bd")

file = ARGV.shift

case
when options[:tokyocabinet]
  tsv = Persist.open_tokyocabinet(file, false)
  puts tsv.summary
when options[:tokyocabinet_bd]
  tsv = Persist.open_tokyocabinet(file, false, nil, TokyoCabinet::BDB)
  puts tsv.summary
else
  header = TSV.parse_header(Open.open(file))

  puts "File: #{ file }"
  puts "Key: #{header.key_field}"
  puts "Fields: "
  header.fields.each_with_index do |f,i|
    puts "  - #{i + 1}: " << f
  end
  puts "Rows: #{`wc -l #{ file }|cut -f 1 -d' '`}"
  puts "First line:"
  parts = []
  header.first_line.split(header.sep).each_with_index{|p,i| parts << "(#{i}) #{p}"}
  puts parts * "\t"
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
rbbt-util-5.5.50 share/rbbt_commands/tsv/info
rbbt-util-5.5.49 share/rbbt_commands/tsv/info
rbbt-util-5.5.48 share/rbbt_commands/tsv/info
rbbt-util-5.5.47 share/rbbt_commands/tsv/info
rbbt-util-5.5.46 share/rbbt_commands/tsv/info
rbbt-util-5.5.45 share/rbbt_commands/tsv/info
rbbt-util-5.5.44 share/rbbt_commands/tsv/info
rbbt-util-5.5.43 share/rbbt_commands/tsv/info
rbbt-util-5.5.42 share/rbbt_commands/tsv/info
rbbt-util-5.5.41 share/rbbt_commands/tsv/info
rbbt-util-5.5.40 share/rbbt_commands/tsv/info
rbbt-util-5.5.39 share/rbbt_commands/tsv/info
rbbt-util-5.5.38 share/rbbt_commands/tsv/info
rbbt-util-5.5.37 share/rbbt_commands/tsv/info
rbbt-util-5.5.36 share/rbbt_commands/tsv/info
rbbt-util-5.5.35 share/rbbt_commands/tsv/info
rbbt-util-5.5.34 share/rbbt_commands/tsv/info