LoginSignup
0
0

More than 1 year has passed since last update.

シェルエスケープの色付けを削除してテキストエディッタで扱いやすくする

Posted at

備忘録。

TL;DR

Mac の zsh 環境で、エスケープシーケンスによる色付けを削除する。

alias mono="sed -E 's/'$'\e''\[([0-9]{1,2}(;[0-9]{1,2})*)?[mK]//g'"

このエイリアスを .bashrc なり .zshrc なりに登録しておく。
GNU sed では置換元の正規表現が違うかも…

使い方

$ mono application.log

# 中身はただの sed なので、もちろんパイプとしても使える。
$ head application.log | mono
0
0
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
0
0