From: Robert Klemme Date: 2009-12-14T18:20:23+09:00 Subject: Re: gsub help 2009/12/13 Siep Korteling : > yermej wrote: >> On Dec 13, 2:34�pm, Kvetch Kvetch wrote: >>> I am reading in a file that is basically a csv file but the delimiter is >>> spaces. �I am also using fastercsv to parse the file into an array. >> >> Check out the docs for fastercsv - http://fastercsv.rubyforge.org/ - >> it looks like the FasterCSV class has default values for separator and >> quote characters. You should be able to change those to ' ' & '^', >> respectively. > > Exactly. Like this: > > ar=FasterCSV.read( path_to_file,{ :col_sep => " ", :quote_char =>'^' }) You can omit brackets to make it look a little better: ar = FasterCSV.read( path_to_file, :col_sep => " ", :quote_char =>'^' ) or, maybe a bit more efficient because you read line by line: CSV.foreach(path_to_file, :col_sep => " ") do |row| ... end Note, in 1.9.* FasterCSV has replaced CSV which is why you can use CSV there. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/