6

On linux there is a great command line program ts. It adds a timestamp to the beginning of each line of input.

Here is an example (on some linux machine):

root@227ee318bbc1:~# echo -e '1\n2\n3'
1
2
3
root@227ee318bbc1:~# echo -e '1\n2\n3' | ts
Apr 19 18:59:52 1
Apr 19 18:59:52 2
Apr 19 18:59:52 3
root@227ee318bbc1:~#

But there is no such program on my mac:

bessarabov@air:~$ echo -e '1\n2\n3' | ts
-bash: ts: command not found

And there is no program with such name in brew.

How can I get ts program on my mac?

  • Seems to be rather easy to solve with a shell script :-) What does file $(type -p ts) return on your Linux system? – nohillside Apr 19 '18 at 19:43
11

Try brew install moreutils and then run the ts command. moreutils installs a bunch of things.

https://rentes.github.io/unix/utilities/2015/07/27/moreutils-package/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .