$ ps -aef | pipe.pl 'grep orien >qi3ber.log' | grep root >root.log #### #!/bin/perl -w use strict; open PIPE, "|@ARGV" or die if @ARGV; if ( @ARGV ) { select PIPE; } else { select STDERR; } while () { print STDOUT $_; print $_; }