require 'cgi' puts '' def row2html str, wrap = "td" "" + str.split(",").map { |cell| "<#{wrap}>#{CGI.escapeHTML cell}" }.join + "" end puts row2html gets.chomp, "th" if ARGV.delete "header" while str = gets puts row2html str.chomp end puts "
"