Ruby: CSV to HTML

Quickly written code for conversion CSV to HTML.
It looks that using awk is a little bit more efficient,
however on the other hand - below code uses opens file
to write and handles input from command line (ARGV).

Following line:

line.strip.gsub(/\"/,"").gsub(/,$/,"").gsub(/,/,"</td><td>")

Drops whitespaces, ", and last commas of every line. Then replaces
commas with </td><td>.

Source code

if ARGV.count < 1
  puts "Usage:"
  puts "  csv2html.rb <csv filename> [output filename]"
  exit
end
 
ifname = ARGV[0]
ofname = "a.out"
ofname = ARGV[1] if ARGV.count > 1
 
str = "<table>\n" # output string
File.open(ifname).each { |line|
  str += "  <tr><td>" + line.strip.gsub(/\"/,"").gsub(/,$/,"").gsub(/,/,"</td><td>") + "</td>\n"
}
str += "</table>"
 
File.open(ofname, 'w') {|f| f.write(str) }