Created
January 11, 2013 06:35
-
-
Save liuliu/4508466 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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