From: kranthi reddy Date: 2008-07-22T23:10:27+09:00 Subject: Re: read CSV file using csv library ------=_Part_71317_20234725.1216736161022 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, To use faster csv you need to install the gem called fastercsv. Then you can do the following data = FasterCSV.read("/root/Desktop/" ) From this data you can access the columns the way you wish. data[0][0] gives you the first column of the first row likewise you can get the other rows also. If you want to get the data for the entire column you can loop through and get the details. If you have any queries feel free to ask me . kranthi. On Tue, Jul 22, 2008 at 6:30 PM, Li Chen wrote: > kranthi reddy wrote: > > Hey you can use faster csv instead using the standard csv ruby library. > > Anyways the answer to your question is as below > > CSV::Reader.parse(File.open('/root/Desktop/lukcy.csv', 'rb')) do |row| > > p.row > > end > > This reads the entire row form the csv file.When you need a specific row > > to > > be rread you can use the foreach iterator or something like row[0] which > > returns the entire first column elements. > > kranthi. > > Hi Kranthi, > > I just need to print out the first column of each row and here are what > I get(only show two, first column of row 1 and row 2): > > # > > # > > > but what I actually need is > > Frontside > > A001:The new student was visibly abashed when the teacher scolded him in > front of the class for reaching late > > I am not sure why I can't print out the part I need. > > Thanks, > > Li > > -- > Posted via http://www.ruby-forum.com/. > > ------=_Part_71317_20234725.1216736161022--