`less textfile|col`と`cat textfile`は同じですか?

`less textfile|col`と`cat textfile`は同じですか?

同じことをless textfile | colして成就しますか?cat textfile

man mysql | col -b > textfileこれも終わったのか気になりますman mysql > textfile

答え1

lessを使用してさまざまな種類の変換を実行できるため、これはかなり異なります$LESSOPEN

答え2

colの出力で作業を実行できる場合とまったく同じではありませんless

ここで重要なのは、less入力ファイルの出力がttyでない場合に出力にコピーされることです。で見ることができますless-451 - main.c - ライン 222:

    /*
     * Set up terminal, etc.
     */
    if (!is_tty)
    {
        /*
         * Output is not a tty.
         * Just copy the input file(s) to output.
         */
        SET_BINARY(1);
        if (nifile() == 0)
        {
            if (edit_stdin() == 0)
                cat_file();
        } else if (edit_first() == 0)
        {
            do {
                cat_file();
            } while (edit_next(1) == 0);
        }
        quit(QUIT_OK);
    }

cat fileしたがって、可能なものと同じ操作を実行するには、次のようにします。

less file | grep ^

関連情報