Sha256: 3f678c24d5a2bedcd77b2713746dbb03ebde943df5574a8e7c5beeed3b5ed919

Contents?: true

Size: 616 Bytes

Versions: 1

Compression:

Stored size: 616 Bytes

Contents

#!/usr/bin/env ruby

require 'xml_split'

if ARGV.length == 3
  input_path, element, output_prefix = ARGV
  x = XmlSplit.new(input_path, element)
  base_output_path = File.expand_path output_prefix
  unless File.directory?(File.dirname(base_output_path))
    $stderr.puts "Creating directory structure #{File.dirname(base_output_path)}"
    require 'fileutils'
    FileUtils.mkdir_p File.dirname(base_output_path)
  end
  x.each_with_index do |part, i|
    File.open("#{base_output_path}_#{'%010d' % i}", 'w') do |f|
      f.write part
    end
  end
else
  puts "Usage: xml_split INPUTPATH ELEMENT OUTPUTPREFIX"
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
xml_split-0.0.2 bin/xml_split