Created
June 18, 2011 04:19
-
-
Save rangerscience/1032799 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
Dir.glob('script/parsing/raw-data/*.ets').each do |filename| | |
puts "Reading #{filename}..." | |
raw = File.open(filename, 'r') | |
section_data = Array.new | |
(0..9).each do |d| | |
puts "Selecting: 00#{d.to_s}" | |
lines = raw.select{|line| /^00#{d.to_s}/.match(line)} | |
puts lines | |
data = parse_section(lines) | |
next if data.nil? | |
section_data.push data unless data.nil? | |
end | |
(10..99).each do |d| | |
lines = raw.select{|line| /^0#{d.to_s}/.match(line)} | |
data = parse_section(lines) | |
next if data.nil? | |
section_data.push data unless data.nil? | |
end | |
(100..999).each do |d| | |
lines = raw.select{|line| /^#{d.to_s}/.match(line)} | |
data = parse_section(lines) | |
next if data.nil? | |
section_data.push data unless data.nil? | |
end | |
make_data "#{File.basename(filename, '.ets')}", section_data | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment