Author Topic: One for the Unix/bash/shell script experts  (Read 177 times)

One for the Unix/bash/shell script experts
« on: June 16, 2020, 09:46:28 pm »
Before I invent this particular wheel is there anything out there that does this:
If I have a process that outputs to stdout say

Hello world
I have done a long job
I have done another long job

What I want is another process that I can pipe that to its stdin , and it will output

00:00 Hello world
10:00 I have done a long job
20:00 I have done another long job

Know what I mean? Where the first bit is just the current time down to second level.
Just so I know when each line got written. Doesn't have to be bash/ shell, could be python or whatever. Main thing is it doesn't disrupt the primary process, (and it doesn't wait to the end of the primary process before writing anything obviously.)
I would ideally like to capture stdout and stderr but I can do that with 2>&1 can't I?
It is what it is. It's not what it's not, so it must be what it is.

Kim

  • Timelord
Re: One for the Unix/bash/shell script experts
« Reply #1 on: June 16, 2020, 09:58:13 pm »
'ts' from the moreutils package does exactly that.
Careful, Kim. Your sarcasm's showing...

Re: One for the Unix/bash/shell script experts
« Reply #2 on: June 17, 2020, 09:24:13 am »
'ts' from the moreutils package does exactly that.
cheers, thought there would be something.  :thumbsup:
It is what it is. It's not what it's not, so it must be what it is.