Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

My output prints approximately 1 line per second to the terminal, maybe 100-200 lines in total.

I've tried to capture the output using tee, but it prints all the lines at the end of the process, not in realtime.

I also tried using the script command, but the output file had some weird characters such as ^M printed along with the results, which is no good.

How can I print in realtime while capturing!?

share|improve this question
2  
While the question is not very clear.. like what is ouput where are you capturing.. but watch may serve your purpose. –  Web-E Sep 25 '13 at 11:56

1 Answer 1

up vote 0 down vote accepted

You need to change the output buffer behaviour of your program with something like stdbuf(1):

stdbuf -oL brasteins-program | tee brasteins-program.log
share|improve this answer
    
Aww yeeeaaahhhh, worked like a charm! Thanks David! I'd upvote you but I don't have enough rep yet :( –  brastein Sep 25 '13 at 12:50
    
Accepting the answer is worth more karma and more helpful to future readers anyway. :-] –  David Foerster Sep 25 '13 at 12:53
    
Btw, just checked your profile, I went to HSU as well :D –  brastein Sep 25 '13 at 12:53
    
My bad, thought I read HSU, not HU in Berlin. Oh well, cheers anyway. –  brastein Sep 25 '13 at 12:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.