Created
June 6, 2011 09:21
-
-
Save callumj/1009981 to your computer and use it in GitHub Desktop.
Reorder Weka parsed CSV files
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
file_p = File.open(ARGV[0]) | |
lines = file_p.readlines | |
file_p.close | |
lines.each do |line| | |
match_data = line.strip.match(/".+(n[0-9]+)_(.+)[.]log",(.+)/) | |
if match_data != nil | |
puts "#{match_data[2]}_#{match_data[1]},#{match_data[3]}" | |
else | |
puts line | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment