So I run "script" to create a session log for something interesting, and it is full of ANSI Escape Codes used by the aliased "ls" command etc. on Linux that are intended to make the terminal colorful.
I did unalias ls in .bashrc and also created a .vimrc with "syntax off" to disable VIM's syntax highlighting, but before that I had already captured the session log with ANSI escape sequences in all their glory.
The following sed command filters them out from a text stream fed to its standard input, to produce a nice clean session log with no ANSI escape sequences. This, and other similar sed commands, can be found here.
sed 's/\x1b\[[0-9;]*[a-zA-Z]//g'
Do something like
cat x.x | sed 's/\x1b\[[0-9;]*[a-zA-Z]//g' > clean.txt
End of this post.
I did unalias ls in .bashrc and also created a .vimrc with "syntax off" to disable VIM's syntax highlighting, but before that I had already captured the session log with ANSI escape sequences in all their glory.
The following sed command filters them out from a text stream fed to its standard input, to produce a nice clean session log with no ANSI escape sequences. This, and other similar sed commands, can be found here.
sed 's/\x1b\[[0-9;]*[a-zA-Z]//g'
Do something like
cat x.x | sed 's/\x1b\[[0-9;]*[a-zA-Z]//g' > clean.txt
End of this post.
No comments:
Post a Comment
"SEO" link builders: move on, your spam link will not get posted.
Note: Only a member of this blog may post a comment.