From: piir@... (Todd Gardner) Date: 2004-06-16T10:33:26+09:00 Subject: Re: How to read a .csv file into a 2D array? "NAKAMURA, Hiroshi" wrote in message news:<40CD69DC.1080400@keynauts.com>... > Hi, > > Todd Gardner wrote: > > How can I read the following text from a .csv file into a 2D array? > > > > Is there a prewritten routine allowing me not to have to parse the file myself? > > With ruby/1.8.1; > % ruby18 -rcsv -e 'p CSV.open("text.tsv", "r", ?\t).collect { |row| > row.to_a }' > > With ruby/1.9; > % ruby -rcsv -e 'p CSV.parse(File.read("text.tsv"), ?\t)' > > A method CSV#parse for parsing string at once (without stream reading) > is recently added. I'll add to ruby/1.8.2. > > Regards, > // NaHi Hello NaHi, Do you have any idea what I may be doing wrong in the code below? E:\Documents and Settings\tnt\ruby\ex\array>ruby -rcsv -e 'p CSV.open("text.csv" , "r", ?\t).collect { |row| row.to_a }' 'row' is not recognized as an internal or external command, operable program or batch file. Domo Arigato Agimashita I'm trying to say many thanks. I am guessing you won't be able to tell because of my almost nonexistent Japanese, Todd