LoginSignup
14
11

More than 5 years have passed since last update.

manやtreeコマンド等の出力結果から特殊文字を除去するcolコマンド

Last updated at Posted at 2014-10-03
  • tree, man等の出力結果には特殊文字・制御コードが含まれる
  • ので、エディタでそのまま開くとコンソールの描画が乱れたりする
  • 神戸在住の colコマンド - 神戸美女Linux を使うと、こうした特殊文字を除去できる
$ tree | col -bx > tree.txt
$ vi tree.txt

$ man | col -bx > man.txt
$ vi man.txt
  • manは「普段使ってるエディタで」「特殊文字を除去した状態で」読むのが一番読みやすく効率も良い。
  • ということでvimmerの自分は.bashrc(or .zshrc)に下記のような関数を追加した。manv <コマンド名>でmanをvim read-onlyで開く
function manv() {
  c=$1
  man ${c} | col -bx | vim -R -
}
14
11
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
14
11