From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: How to redirect output without escape sequences to a file
Date: Mon, 16 May 2011 14:36:50 -0700 [thread overview]
Message-ID: <110516143650.ZM27794@torch.brasslantern.com> (raw)
In-Reply-To: <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.
prev parent reply other threads:[~2011-05-16 21:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-08 19:27 Thorsten Kampe
2011-05-09 1:58 ` Aaron Davies
2011-05-09 15:01 ` Bart Schaefer
2011-05-12 18:10 ` Thorsten Kampe
2011-05-13 6:32 ` Bart Schaefer
2011-05-16 11:03 ` Thorsten Kampe
2011-05-16 21:36 ` Bart Schaefer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=110516143650.ZM27794@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).