Created
May 22, 2017 13:53
-
-
Save raydive/9e031ad9f4d8aa48e09204c3cc884c74 to your computer and use it in GitHub Desktop.
特定のIDを持つCSVファイルの行を削除する簡単なrubyスクリプト
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 'csv' | |
OUTPUT_FILE = 'output.csv' | |
src_file, dist_file, _ = ARGV | |
deleted_data = CSV.read(src_file).flatten[2..-1] | |
CSV.open(OUTPUT_FILE, 'w') do |file| | |
CSV.foreach(dist_file) do |row| | |
file << row unless deleted_data.include?(row.first) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment