[mdlug] [HOWTO request] filter stderrr without altering stdout

Michael Corral micorral at comcast.net
Wed Apr 11 11:43:31 EDT 2007


Robert Meier a ecrit:
> For instance, is there a redirection usage that can carry interactive
> stdout past grep, and apply grep to stderr only?

I don't know of a way of doing this with the old ksh (ksh88).
With the newer ksh93, it can be done like this:

some_command 2>&1- | grep something_from_stderr

That moves (instead of duplicates) stdout to stderr.

To see which version of ksh you are running, do 'set -o emacs'
then hit CTRL-v, the output will end with either 88* or 93*.
If you're working on Solaris or HP-UX, then ksh93 is available
as /usr/dt/bin/dtksh. If you're in Linux, you can get ksh93 at
http://www.kornshell.com

Michael



More information about the mdlug mailing list