Skip to content

Instantly share code, notes, and snippets.

@rgreenjr
Created January 18, 2010 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rgreenjr/280206 to your computer and use it in GitHub Desktop.
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.
#!/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