Use tee to send output to the console and to a file:
machine:dir user$ ./some_program | tee output_file.txt
Executing the above command will display the output of some_program immediately in the console and write the same contents to output_file.txt.
I use this command mostly for diffs against svn, saves a step. Also, though I'm posting this as a Mac OS X terminal option, I first discovered this on Ubuntu 8.04 though I sure the history or this command is much older. I recall from the documentation to think of this in plumbing terms: Send your output down a pipe to a "T" essentially sending the same stream/flow to two different places.
~Fin
No comments:
Post a Comment