Skip to content

Instantly share code, notes, and snippets.

@dce
Created December 15, 2008 20:58
Show Gist options
  • Save dce/36086 to your computer and use it in GitHub Desktop.
Save dce/36086 to your computer and use it in GitHub Desktop.
Warrior X-Fit Fight Data Conversion
curdate = ""
data = File.open("fights.txt").read
data.gsub!(/^(Month|Name|Red|Gray).*\n/, '')
data.gsub!(/\t/, '","')
data.gsub!(/^/, '"').gsub!(/$/, '"')
data.gsub!(/(\w+), (\w+)/, "\\2 \\1")
data.gsub!(/(,"")*$/, '')
data.split("\n").each do |line|
if line.include?(",")
puts curdate + "," + line
else
curdate = line
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment