Created
January 30, 2015 07:14
-
-
Save vargheseraphy/75f4620c07b788ad347f to your computer and use it in GitHub Desktop.
Run parse.rb to see how the HTML files are parsed.
This file contains hidden or 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
require 'nokogiri' | |
Dir.foreach('/Users/geordee/Projects/Data') do |filename| | |
next if filename == '.' or filename == '..' | |
puts "Processing #{filename}" | |
fin = File.open(filename, "r") | |
html = Nokogiri::HTML(fin) | |
textarea = html.search("//textarea") | |
fout = File.new("#{filename}.txt", "w") | |
fout.write(textarea.first.children.to_s) if textarea.first | |
fin.close | |
fout.close | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment