S
Stuart Clarke
I am trying to parse data from a file where the values are common
seperated, however there is slightly more to the file than just commas,
see below
for
(;;{"t":"msg","c":"p_114000000","ms":[{"type":"msg","msg":{"text":"you
around"}]}
From reading around fasterCSV seems the way forward therefore I have
this code
require 'rubygems'
require 'faster_csv'
FasterCSV.foreach("C:\\Documents and
Settings\\sjc\\Desktop\\p_1149549999=2[1].txt", :row_sep => ",") do
|row|
puts row[0]
break
end
However I am getting an error like this
C:/Program
Files/ruby/lib/ruby/gems/1.8/gems/fastercsv-1.4.0/lib/faster_csv.rb:1
650:in `shift': Illegal quoting on line 1.
(FasterCSV::MalformedCSVError)
from C:/Program
Files/ruby/lib/ruby/gems/1.8/gems/fastercsv-1.4.0/lib/fa
ster_csv.rb:1568:in `loop'
from C:/Program
Files/ruby/lib/ruby/gems/1.8/gems/fastercsv-1.4.0/lib/fa
ster_csv.rb:1568:in `shift'
from C:/Program
Files/ruby/lib/ruby/gems/1.8/gems/fastercsv-1.4.0/lib/fa
ster_csv.rb:1513:in `each'
from C:/Program
Files/ruby/lib/ruby/gems/1.8/gems/fastercsv-1.4.0/lib/fa
ster_csv.rb:1017:in `foreach'
from C:/Program
Files/ruby/lib/ruby/gems/1.8/gems/fastercsv-1.4.0/lib/fa
ster_csv.rb:1191:in `open'
from C:/Program
Files/ruby/lib/ruby/gems/1.8/gems/fastercsv-1.4.0/lib/fa
ster_csv.rb:1016:in `foreach'
from C:/Documents and Settings/sjc/Desktop/test.rb:4
Can anyone help me out with this?
Many thanks
seperated, however there is slightly more to the file than just commas,
see below
for
(;;{"t":"msg","c":"p_114000000","ms":[{"type":"msg","msg":{"text":"you
around"}]}
From reading around fasterCSV seems the way forward therefore I have
this code
require 'rubygems'
require 'faster_csv'
FasterCSV.foreach("C:\\Documents and
Settings\\sjc\\Desktop\\p_1149549999=2[1].txt", :row_sep => ",") do
|row|
puts row[0]
break
end
However I am getting an error like this
C:/Program
Files/ruby/lib/ruby/gems/1.8/gems/fastercsv-1.4.0/lib/faster_csv.rb:1
650:in `shift': Illegal quoting on line 1.
(FasterCSV::MalformedCSVError)
from C:/Program
Files/ruby/lib/ruby/gems/1.8/gems/fastercsv-1.4.0/lib/fa
ster_csv.rb:1568:in `loop'
from C:/Program
Files/ruby/lib/ruby/gems/1.8/gems/fastercsv-1.4.0/lib/fa
ster_csv.rb:1568:in `shift'
from C:/Program
Files/ruby/lib/ruby/gems/1.8/gems/fastercsv-1.4.0/lib/fa
ster_csv.rb:1513:in `each'
from C:/Program
Files/ruby/lib/ruby/gems/1.8/gems/fastercsv-1.4.0/lib/fa
ster_csv.rb:1017:in `foreach'
from C:/Program
Files/ruby/lib/ruby/gems/1.8/gems/fastercsv-1.4.0/lib/fa
ster_csv.rb:1191:in `open'
from C:/Program
Files/ruby/lib/ruby/gems/1.8/gems/fastercsv-1.4.0/lib/fa
ster_csv.rb:1016:in `foreach'
from C:/Documents and Settings/sjc/Desktop/test.rb:4
Can anyone help me out with this?
Many thanks