There is a python script:
from time import sleep sleep(5) print 'some_line1' sleep(5) print 'some_line2' Displays two lines with a delay of 5 seconds.
Redirect output to file:
# python script.py > outfile.txt We outfile.txt our two lines in the file outfile.txt , but only after 10 seconds, i.e. after full execution of the script, for all 10 seconds the file was empty.
The question is how to get this data to the file instantly, because there may be not two lines, but tens of thousands, and you do not want to wait for the complete execution of the script.