file = File.open "file.txt" #1 solution would eat a lot of RAMp [*file][n-1] #2 solution would notn.times{ file.gets }p $_ file.close