Sha256: 8b571540be8393cf8d53b2fd7a5b8992df413205b2b1d59536e00d67d9b9697d
Contents?: true
Size: 1019 Bytes
Versions: 18
Compression:
Stored size: 1019 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 absolute value $ 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| e.to_f.abs } : [v.to_f.abs] puts [k,v].flatten * "\t" end
Version data entries
18 entries across 18 versions & 1 rubygems