http://qs321.pair.com?node_id=1217337


in reply to Re^2: Print contents of text file line by line
in thread Print contents of text file line by line

Unless you really want to print only selected lines of the file, you probably should use the line-by-line approach that you currently (unintentionally) wrote, and add a counter of the number of times this loop has executed, and end the loop after you have printed enough. This will work for any file regardless of size.