Skip to content

Instantly share code, notes, and snippets.

@zunda
Created June 14, 2012 03:10
Show Gist options
  • Save zunda/2927831 to your computer and use it in GitHub Desktop.
Save zunda/2927831 to your computer and use it in GitHub Desktop.
カンマ区切りのファイルをパイプ区切りのファイルに変換する。データにパイプがあると変になるよ
#!/usr/bin/ruby
# usage: ruby csv2psv.rb path-to.csv > path-to.psv
#
# Copyright 2012 (C) zunda <zunda at freeshell.org>
#
# Permission is granted for use, copying, modification,
# distribution, and distribution of modified versions of this
# work as long as the above copyright notice is included.
require 'csv'
CSV.foreach(ARGV.shift) do |row|
puts row.join('|')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment