Saving output of a command and echoing to the screen

When using bash, it’s really nice to both save the output of a command to a file and print it on the screen. I couldn’t find something that did this so I wrote my own ruby script. A utility that does exactly what you want is actually included in a standard linux install, but with a filename that I simply couldn’t google. tee does what you need:

$ hadoop --jar $J/job.jar --job asdf | tee -a log.asdf.00

saves stdout to log.job.00 and echoes to screen

This entry was posted in bash, Data Munging. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>