I would like to create a CSV filter, so I want to read from STDIN and write
to STDOUT.
This does not work, even though this is per the the CSV web documentation:
require "rubygems"
require "csv"
require "nokogiri"
CSV($stdin, { :headers => true }){ |csv_in| csv_in.each { |row| p row } }
/Users/joe/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/csv.rb:1871:in `block (2
levels) in shift': Unquoted fields do not allow \r or \n (line 1).
(CSV::MalformedCSVError)
from /Users/joe/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/csv.rb:1836:in `each'
from /Users/joe/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/csv.rb:1836:in `block
in shift'
from /Users/joe/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/csv.rb:1796:in `loop'
from /Users/joe/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/csv.rb:1796:in `shift'
from /Users/joe/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/csv.rb:1738:in `each'
from tt.rb:6:in `block in <main>'
from /Users/joe/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/csv.rb:1048:in
`instance'
from /Users/joe/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/csv.rb:2320:in `CSV'
from tt.rb:6:in `<main>'
Any thought?
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/3f8b1d7b-8052-44f0-8875-5121f8a48f2e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.