From: "lrlebron@..." Date: 2007-12-29T05:20:08+09:00 Subject: Re: How to jump over the first line in a file? (newbie) 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