Sha256: f7ae9a96e600fffc697d14b9dee1f6668b8f744f0ae1920b636268e042995cad
Contents?: true
Size: 1.01 KB
Versions: 2
Compression:
Stored size: 1.01 KB
Contents
#!/usr/bin/env ruby require "masticate" command, filename = ARGV case ARGV.shift when 'sniff' file = File.open(filename) results = Masticate.sniff(file) col_sep = results[:col_sep] col_sep = "TAB" if col_sep == "\t" file.close $stderr.puts <<-EOT Processing complete. Input delimiter: #{col_sep} Field counts: #{results[:field_counts].join(',')} EOT when 'mend' file = File.open(filename) metadata = Masticate.sniff(file) col_sep = metadata[:col_sep] col_sep = "TAB" if col_sep == "\t" file.close file = File.open(filename) results = Masticate.mend(file, metadata.merge(:output => $stdout)) file.close $stderr.puts <<-EOT Processing complete. Input delimiter: #{col_sep} Lines in input: #{results[:input_records]} Lines in output: #{results[:output_records]} EOT when 'csvify' file = File.open(filename) metadata = Masticate.sniff(file) file.close file = File.open(filename) Masticate.csvify(file, metadata.merge(:output => $stdout)) else raise "unknown command #{command}" end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
masticate-0.0.3 | bin/masticate |
masticate-0.0.2 | bin/masticate |