From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17540 invoked by alias); 16 May 2011 21:37:06 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 16033 Received: (qmail 18222 invoked from network); 16 May 2011 21:37:05 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <110516143650.ZM27794@torch.brasslantern.com> Date: Mon, 16 May 2011 14:36:50 -0700 In-reply-to: Comments: In reply to Thorsten Kampe "Re: How to redirect output without escape sequences to a file" (May 16, 1:03pm) References: <110509080130.ZM19360@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: How to redirect output without escape sequences to a file MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On May 16, 1:03pm, Thorsten Kampe wrote: } } > ... 2>>(col > trace.log) >&2 } } ...and somehow not working (form me). I still got (stripped) color stuff } in the output file ("1m33m-0m39m service:directory-agent" for instance). Hmm, must depend on what "col" is able to determine are escape sequences. } "| sed 's/\x1b\[[0-9]\{1,2\}m//g'" worked for me. } } How would the command line look like if wanted to pipe stdout and stderr } to sed, and then redirect both to trace.log? { ... } |& sed 's/\x1b\[[0-9]\{1,2\}m//g' > trace.log where "..." is your original command. If you want to pipe ONLY stderr to sed, and then redirect both to trace.log, you'd need something more along the lines of { { ... } 2>>( sed 's/\x1b\[[0-9]\{1,2\}m//g' >&2 ) } >&trace.log However in that case "sed" runs in the background so you're not guaranteed to get the same interleaving of output in trace.log as if you join stdout+stderr together sooner.