2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

typescriptのカラーコードとバックスペースを除去

Last updated at Posted at 2017-01-15

RaspberryPiでコマンドの実行ログを残しておこうとして、scriptコマンドを使用したが、カラーコードやバックスペースがそのまま残ってしまい編集しにくかったので、除去する方法。
sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})*)?[m|K]//g" typescript| col -bx >typescript.txt
まだいくつかのカーソル移動のエスケープシーケンスとか残っていそうだけど、かなり見やすくなったので、ひとまずはこれでよしとする。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?