Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Ruby (http://www.velocityreviews.com/forums/f66-ruby.html)
-   -   File question (http://www.velocityreviews.com/forums/t851282-file-question.html)

Justin To 06-30-2008 01:16 AM

File question
 
Hi, just wondering how I would skip the first line of a file?

File.open('file.txt', 'r').each do |line|
# start on the 2nd line
end

Thanks!
--
Posted via http://www.ruby-forum.com/.


Justin To 06-30-2008 02:00 AM

Re: File question
 
Thanks, helps a lot. How about if I am using FasterCSV?

require 'fastercsv'



File.open("file.txt', 'r') do |file|
file.readline
FasterCSV.foreach("#{file}") do |row|

end

end

Invalid argument #<file...>

Mmm... not sure how I would do it then! =)

Thanks
--
Posted via http://www.ruby-forum.com/.


Justin To 06-30-2008 02:57 AM

Re: File question
 
Terrific, thanks so much!
--
Posted via http://www.ruby-forum.com/.



All times are GMT. The time now is 06:39 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57