2

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?

Olivier Pons
  • 612
  • 1
  • 5
  • 21
  • @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.SE]). 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 Answers1

4

There is a similar question en Stack Overflow:

https://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)

Dettorer
  • 156
  • 5