Using Dataset to iterate over lines of large files

Refer to How to use dataset larger than memory?. The ChunkDataset API might help you