Is there any way to always save only the last "console" output to log file?
For example executing this
python3 program.py > log.txt
It will always store all the console prints to log.txt.
Even if inside python print has \r.
Just to be clear, I want to log the last of the output BUT I don't want to lose any data. For example, using tail indeed work but it will log the data only after the execution is over. I want to save the last line run time.