From: Joe Date: 2007-12-29T06:01:02+09:00 Subject: Re: How to jump over the first line in a file? (newbie) I don't see File.open here: http://ruby-doc.org/core/classes/File.html Am I looking in the wrong place? Also, how do you find out about globals like $. ? Joe On Dec 28, 2007 3:20 PM, lrlebron@gmail.com wrote: > > On Dec 28, 12:49 pm, Mark Toth wrote: > > 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 > > -- > > Posted viahttp://www.ruby-forum.com/. > > The $. variable holds the line number so you could do something like > this: > > File.open("filename.txt") do |aFile| > aFile.each_line do |line| > if $. > 1 > #processs data here > > end > end > end > > > Luis > > >