How to get a particular line from a file
file-io, ruby
Solution
Try one of these two solutions:
file = File.open "file.txt"
#1 solution would eat a lot of RAM
p [*file][n-1]
#2 solution would not
n.times{ file.gets }
p $_
file.close
Problem
Is it possible to extract a particular line from a file knowing its line number? For example, just get the contents of line `N` as a string from file "text.txt"?