Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to make a shell-pipe like this:

producer | analyser > report.txt

and watch the output of producer while it is generating data (a big log-file) for analysis.

How can I do that?

share|improve this question
up vote 4 down vote accepted

In /bin/sh and compatibles:

producer | tee /dev/fd/3 | (analyser > report.txt) 3>&1

I've tested this only on Linux and Cygwin. On some Unix-likes you may have to change /dev/fd/3 to whatever their equivalent is.

share|improve this answer
that will show and save the output of analyser, right? I want to see the output of producer. – Bastl Feb 10 '12 at 12:12
sorry - better now? – reinierpost Feb 10 '12 at 12:14
That will save producer's output to report.txt and I'd have to watch it using "tail -F". Not exactly what I wanted... – Bastl Feb 10 '12 at 12:16
Fixed once again. I should learn to actually read stuff before replying. – reinierpost Feb 10 '12 at 12:25
On Ubuntu, I had to use /dev/fd/2 for stdout. Thanks! – Bastl Feb 10 '12 at 13:33

You must log in to answer this question.

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