-
-
Save phroa/dcf7ec5e5007bd7d715542167f1e04fc 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 | |
require 'csv' | |
lines = ARGF.each_line.map(&:chomp) | |
# This may have to be 15 on windows computers for unknown reasons; line endings? | |
slices = lines.each_slice(14).map do |slice| | |
slice.map do |l| | |
l.split ',' | |
end | |
end | |
data = CSV.generate do |csv| | |
csv << ['Team', 'Match', 'Alliance', 'Auto Baseline', 'Auto Low', 'Auto High', 'Auto Gear', 'Teleop Low', 'Teleop High', 'Gears', 'Climbed', 'Comments'] | |
slices.each do |slice| | |
a = [slice[0][1].strip, | |
slice[2][1].strip, | |
slice[1][1].strip, | |
slice[4][1].strip, | |
slice[5][1].strip, | |
slice[6][1].strip, | |
slice[7][1].strip, | |
slice[9][1].strip, | |
slice[10][1].strip, | |
slice[11][1].strip, | |
slice[12][1].strip] | |
a << slice[14][1].strip if slice[14][1] | |
csv << a | |
end | |
end | |
puts data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment