From: Stefano Crocco Date: 2007-12-29T04:05:42+09:00 Subject: Re: How to jump over the first line in a file? (newbie) Alle venerdì 28 dicembre 2007, Mark Toth ha scritto: > I have this code: > > file = "filename.txt" > File.open(file) do |sFile| > while line = sFile.gets > row = line.split("\t") > a_product = Product.new( > > :sku => row[0] , > :name => row[1] , > :price => row[2] , > > a_product.save > end > end > > What if I want to jump over the first line of the file so it won´t be > imported? > > Thank you, > > Mark A possibility is to do a call to sFile.gets before the while cycle. This way, the first line of the file is read but not used. Stefano