Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- *stderr2stdin
- ```
- 2>&1
- ```
- *timestamp on each line
- ```
- examples
- echo -e "foo\nbar\nbaz" | ts '[%Y-%m-%d %H:%M:%S]'
- command | while IFS= read -r line; do printf '[%s] %s\n' "$(date '+%Y-%m-%d %H:%M:%S')" "$line"; done
- command | gawk '{ print strftime("[%Y-%m-%d %H:%M:%S]"), $0 }'
- command | perl -pe 'use POSIX strftime; print strftime "[%Y-%m-%d %H:%M:%S] ", localtime'
- command | python -c 'import sys,time;sys.stdout.write("".join(( " ".join((time.strftime("[%Y-%m-%d %H:%M:%S]", time.localtime()), line)) for line in sys.stdin )))'
- command | ruby -pe 'print Time.now.strftime("[%Y-%m-%d %H:%M:%S] ")'
- ```
Add Comment
Please, Sign In to add comment