Created
May 9, 2014 13:45
-
-
Save mjg123/8ecb7be6414ddfa979c8 to your computer and use it in GitHub Desktop.
tiny shell script for adding timestamps to lines piped in from stdin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while read f; do | |
date +"%H:%M:%S " | tr -d '\n'; | |
echo $f; | |
done |
or, as a one-liner:
some-fancy-command | while read f; do date +"%H:%M:%S " | tr -d '\n'; echo $f; done
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
[~] cat | ./timestamper.sh
Hello
14:46:45 Hello
how are you
14:46:50 how are you