Skip to content

Instantly share code, notes, and snippets.

@IanVaughan
Created September 15, 2020 10:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IanVaughan/8b4f3fe617e5bbf1a4edc19d2fc47079 to your computer and use it in GitHub Desktop.
Save IanVaughan/8b4f3fe617e5bbf1a4edc19d2fc47079 to your computer and use it in GitHub Desktop.
Convert a log of hashes into json files in ruby
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