Created
September 15, 2020 10:42
-
-
Save IanVaughan/8b4f3fe617e5bbf1a4edc19d2fc47079 to your computer and use it in GitHub Desktop.
Convert a log of hashes into json files in ruby
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
i=0 | |
file = File.read('log') | |
file.each_line do |line| | |
hash = eval line | |
File.write("data-#{i}.json", hash.to_json) | |
puts i | |
i+=1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment