Guest User

Untitled

a guest
Dec 19th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. *stderr2stdin
  2. ```
  3. 2>&1
  4. ```
  5.  
  6. *timestamp on each line
  7. ```
  8. examples
  9. echo -e "foo\nbar\nbaz" | ts '[%Y-%m-%d %H:%M:%S]'
  10. command | while IFS= read -r line; do printf '[%s] %s\n' "$(date '+%Y-%m-%d %H:%M:%S')" "$line"; done
  11. command | gawk '{ print strftime("[%Y-%m-%d %H:%M:%S]"), $0 }'
  12. command | perl -pe 'use POSIX strftime; print strftime "[%Y-%m-%d %H:%M:%S] ", localtime'
  13. 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 )))'
  14. command | ruby -pe 'print Time.now.strftime("[%Y-%m-%d %H:%M:%S] ")'
  15. ```
Add Comment
Please, Sign In to add comment