Home Save last line of output to log file in linux
Reply: 0

Save last line of output to log file in linux

user549
1#
user549 Published in June 19, 2018, 11:56 pm

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.

Any suggestions?

EDIT. 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.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.492956 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO