Skip to content

Instantly share code, notes, and snippets.

@liuliu
Created January 11, 2013 06:35
Show Gist options
  • Save liuliu/4508466 to your computer and use it in GitHub Desktop.
Save liuliu/4508466 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
exit unless ARGV.length == 1
file = File.new ARGV[0]
residual = 0
filename = nil
file.each do |line|
case residual
when 0 then
filename = line.strip + ".jpg"
residual = -1
when -1 then
residual = line.to_i
else
coords = line.split(" ")
residual -= 1
print filename + " " + coords[0] + " " + coords[1] + " " + coords[2] + " " + coords[3] + " " + coords[4] + "\n"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment