Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: How to redirect output without escape sequences to a file
- X-seq: zsh-users 16033
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: How to redirect output without escape sequences to a file
- Date: Mon, 16 May 2011 14:36:50 -0700
- In-reply-to: <iqr0a0$f92$2@dough.gmane.org>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <iq6qrc$39j$1@dough.gmane.org> <110509080130.ZM19360@torch.brasslantern.com> <iqr0a0$f92$2@dough.gmane.org>
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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author