Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'd like to execute this command:

find /apps/ -type f -print0 | grep -z log$ | xargs -0 grep 'this->aForm'

And in parallel, I'd like to see which files are being processed.

How to to this?

share|improve this question

closed as off-topic by voretaq7 Jul 10 '13 at 15:25

  • This question does not appear to be about professional server, networking, or related infrastructure administration within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

    
@oliver While it's not a bad question I'm going to close this as off-topic as it really doesn't directly deal with system administration (general scripting questions are more appropriate on Unix & Linux). If you'd like to try for more answers I can migrate this, but it's useful here as a signpost pointing to the Stack Overflow question too... –  voretaq7 Jul 10 '13 at 15:25

1 Answer 1

up vote 2 down vote accepted

There is a similar question en Stack Overflow:

http://stackoverflow.com/questions/670784/redirecting-bash-stdout-stderr-to-two-places

The idea is to use named pipes, in bash you can simply do:

command_that_writes_to_stdout | tee >(command_that_reads_from_stdin)

But in the general case, use mkfifo, for example:

mkfifo some_pipe
command_that_writes_to_stdout | tee some_pipe \
  & command_that_reads_from_stdin < some_pipe
rm some_pipe

(both examples are from the Stack Overflow answer)

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.