LoginSignup
1
1

More than 5 years have passed since last update.

manコマンドをテキストファイルに出力

Last updated at Posted at 2019-04-18

Web上のmanページが環境に合っているのか分からないので、計算機のman結果をWindowsで読める様にして展開することがそこそこあります。

単純に書くなら以下。
最近はcolコマンドで制御文字抜かなくても大丈夫みたいですけど一応。

man AAA | col -bx | > BBB

自分は一々長いコマンドを打つのが面倒なので~/.bashrcに以下のシェル関数を追加しています。
ついでに引数でセクションを選択出来る様にしてます。

function man2txt
{
    if [ $# = 1 ]; then
        man $1 | col -bx > ${1}.man
    elif [ $# = 2 ]; then
        man $1 $2 |col -bx > ${2}_${1}.man
    else
        echo "ex)man2txt [section] word"
    fi
}
1
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
1
1