19 строки
311 B
Ruby
Executable File
19 строки
311 B
Ruby
Executable File
#!/usr/bin/env ruby
|
|
require 'CSV'
|
|
|
|
def get_dest(src)
|
|
dest = src.split('.')
|
|
dest[0] += '-transposed'
|
|
dest.join('.')
|
|
end
|
|
|
|
src = ARGV[0]
|
|
file = File.open(src, "r:ISO-8859-1")
|
|
rows = CSV.parse(file)
|
|
|
|
CSV.open(get_dest(src), "wb") do |csv|
|
|
rows.transpose.each do |row|
|
|
csv << row
|
|
end
|
|
end
|