Created
December 15, 2008 20:58
-
-
Save dce/36086 to your computer and use it in GitHub Desktop.
Warrior X-Fit Fight Data Conversion
This file contains hidden or 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
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