5
4

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.

ANSIエスケープシーケンス出力をHTMLに変換したい

Last updated at Posted at 2016-09-07

ふと、Rails のログなど ANSI エスケープシーケンス使って吐かれたテキストを HTML に変換したくなったので調べてみたら、ansifilter なるものがあるらしい。

CentOS 7 だと yum でインストール出来た(epel リポジトリ)。

ubuntu 16.04 LTS だと apt-get でインストール出来ないので、ソースを取得して、make、適当な所にコピー(もしくは make install で /usr/bin にインストール)。

$ wget http://www.andre-simon.de/zip/ansifilter-2.0.tar.bz
$ tar jxf ansifilter-2.0.tar.bz2
$ cd ansifilter-2.0/
$ make
$ cd src
$ cp ansifilter ~/bin

例えば、Rails の development.log を HTML に変換したい場合は、以下の通り。

$ ansifilter development.log -H > out.html
5
4
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
5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?