From: Craig Demyanovich Date: 2009-03-03T00:08:20+09:00 Subject: Re: How to find the specific row of CSV file. --00163642719ebb1ae004642434cc Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On Mon, Mar 2, 2009 at 5:04 AM, Salil Gaikwad wrote: > it doesn't work. > I am going to basic > > > file="C:/Documents and Settings/All Users/Documents/auctiva2.csv" > File.open(file,"r").each_line("\r") {|sFile| > for row in sFile.split(",") > > #More code here > > end > > } > > > but it gives me error when line separator is \n. > > is it a bug that fastercsv/csv can't read all the special characters at > once. > because i try all the possible things i can do if u have any solution > please explain in detail. If I take your earlier attached file of MP3 sales, this simple program appears to me to parse it correctly. require 'fastercsv' FasterCSV.foreach('AUBI_Summary_Statement_UK_12-2008.csv', :headers => :first_row) do |row| puts row.inspect end Note that I removed the first two lines of the file, since I don't know how to skip them. Then, I just treat what's now the first line as a header row. Each line is then parsed into an instance of FasterCSV::Row. Here's what the first row looks like when inspected. # To access a specific value, you could do something like row["ASIN"] which would return "B001K809QG". By the way, I don't know what to do w/ the last two lines of the MP3 sales file. They look like junk to me right now. Regards, Craig -- Craig Demyanovich Mutually Human Software http://mutuallyhuman.com --00163642719ebb1ae004642434cc--