Sha256: 80af72bf91d41308f6c5a919c5101bd622d96e69a7f010726a602dc13525b01f

Contents?: true

Size: 1021 Bytes

Versions: 18

Compression:

Stored size: 1021 Bytes

Contents

#!/usr/bin/env ruby

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

require 'rbbt/util/R'

$0 = "rbbt #{$previous_commands*""} #{ File.basename(__FILE__) }" if $previous_commands

options = SOPT.setup <<EOF
Take logs

$ rbbt stat density <file>

Display summary information. Works with Tokyocabinet HDB and DBD as well.

-tch--tokyocabinet File is a TC HDB
-tcb--tokyocabinet_bd File is a TC BDB
-t--type* Type of tsv (single, list, double, flat)
-h--header_hash* Change the character used to mark the header line (defaults to #)
-f--field Field to change
-h--help Help
EOF

SOPT.usage if options[:help]

file = ARGV.shift

if file == '-' or file.nil?
  file = STDIN 
else
  file = Open.open file
end

parser = TSV::Parser.new file, options

options[:fields] = [options.delete(:field) || 0]
puts TSV.header_lines(parser.key_field, parser.fields)
parser.traverse(options.merge(:type => :list)) do |k,v|
  v = v.first
  v = Array === v ? v.collect{|e| Math.log(e.to_f) } : [Math.log(v.to_f)]
  puts [k,v].flatten * "\t"
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
rbbt-util-5.9.8 share/rbbt_commands/stat/log
rbbt-util-5.9.7 share/rbbt_commands/stat/log
rbbt-util-5.9.6 share/rbbt_commands/stat/log
rbbt-util-5.9.5 share/rbbt_commands/stat/log
rbbt-util-5.9.4 share/rbbt_commands/stat/log
rbbt-util-5.9.3 share/rbbt_commands/stat/log
rbbt-util-5.9.2 share/rbbt_commands/stat/log
rbbt-util-5.9.1 share/rbbt_commands/stat/log
rbbt-util-5.9.0 share/rbbt_commands/stat/log
rbbt-util-5.8.10 share/rbbt_commands/stat/log
rbbt-util-5.8.9 share/rbbt_commands/stat/log
rbbt-util-5.8.8 share/rbbt_commands/stat/log
rbbt-util-5.8.7 share/rbbt_commands/stat/log
rbbt-util-5.8.6 share/rbbt_commands/stat/log
rbbt-util-5.8.4 share/rbbt_commands/stat/log
rbbt-util-5.8.3 share/rbbt_commands/stat/log
rbbt-util-5.8.2 share/rbbt_commands/stat/log
rbbt-util-5.8.1 share/rbbt_commands/stat/log