Read a large file without loading it into memory

Python

Iterating a file object yields one line at a time, which is the difference between a constant footprint and an OOM.

with open('access.log', encoding='utf-8') as fh:
    for line in fh:
        if 'ERROR' in line:
            print(line.rstrip())

More in Python

Random picks