Skip to content

Instantly share code, notes, and snippets.

@violetyk
Created December 2, 2015 02:16
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 violetyk/f6bddb9019c7e4c29160 to your computer and use it in GitHub Desktop.
Save violetyk/f6bddb9019c7e4c29160 to your computer and use it in GitHub Desktop.
CSVからURLを抽出してCSVファイルに書き出すスクリプト
# "12345", "long text...."
# "12346", "long text...."
require 'csv'
require 'uri'
CSV.open('url.csv', 'wb', force_quotes: true) do |output|
CSV.read('about.csv', encoding: 'UTF-8:UTF-8', header_converters: nil).map do |input|
tmp = []
tmp << input[0]
tmp << URI.extract(input[1])
output << tmp.flatten
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment