Created
January 18, 2010 17:25
-
-
Save rgreenjr/280206 to your computer and use it in GitHub Desktop.
Trims Goodreads CSV files so they import into Delicious Library essential data only.
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
#!/usr/bin/env ruby -w | |
# | |
# Trims Goodreads CSV files so they import into Delicious Library essential data only. | |
# | |
require 'rubygems' | |
require 'faster_csv' | |
path = ARGV.empty? ? "/Users/rgreen/Downloads/goodreads_export.csv" : ARGV[0] | |
puts "Title,Author,ASIN,ISBN" | |
text = "" | |
File.open(path) { |file| text = file.read } | |
text.gsub!(/",="/, "\",\"") | |
FasterCSV.parse(text, :headers => true) do |row| | |
puts "\"#{row[0]}\",\"#{row[1]}\",\"#{row[4]}\",\"#{row[4]}\"" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment