2018年11月7日 星期三

ts moreutils time stamp log



make clean;make 2>&1 | tee >(ts "%H_%M_%S" > spendinglogs6.log)


https://unix.stackexchange.com/questions/26728/prepending-a-timestamp-to-each-line-of-output-from-a-command

I wish to prepend a timestamp to each line of output from a command. For example:
foo
bar
baz
would become
[2011-12-13 12:20:38] foo
[2011-12-13 12:21:32] bar
[2011-12-13 12:22:20] baz


https://stackoverflow.com/questions/39239379/add-timestamp-to-teed-output-but-not-original-output

Check out ts from the moreutils package.
If you're using bash, you can tee to a shell pipe as a file:
https://unix.stackexchange.com/questions/272433/piping-into-moreutils-ts-with-nanosecond-precision
https://manpages.debian.org/testing/moreutils/ts.1.en.html
https://rentes.github.io/unix/utilities/2015/07/27/moreutils-package/
https://joeyh.name/code/moreutils/

1 則留言:


  1. make log add time stamp spending time log

    make clean;make 2>&1 | tee >(ts "%H_%M_%S" > spendinglogs5.log)

    回覆刪除