Skip to content

Instantly share code, notes, and snippets.

@openfirmware
Created November 5, 2014 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save openfirmware/5987821b75dfc862639a to your computer and use it in GitHub Desktop.
Save openfirmware/5987821b75dfc862639a to your computer and use it in GitHub Desktop.
Osmosis replag output converter
#!/usr/bin/env ruby -KU
# Convert output from osmosis to CSV for spreadsheets.
# Usage: ./convert.rb output
file = ARGV[0]
def parse(line)
matches = line.match(/^\[([^\]]+)\] \d+ start import from seq-nr (\d+), replag is (\d+) day\(s\) and (\d+) hour\(s\)$/)
{
date: matches[1],
sequence: matches[2],
days: matches[3],
hours: matches[4]
}
end
IO.foreach(file) do |x|
result = parse(x)
puts [result[:date], 6, result[:sequence], result[:days], result[:hours]].join(',')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment