从文件中删除终端格式

从文件中删除终端格式

我曾经script将其他一些脚本的输出转储到文件中。虽然它工作得很好,但输出已格式化(颜色等),所以现在它作为原始文本不可读 - 我必须使用catorless代替。代码如下所示:

[32m这些是要合并的包,按顺序:[39;49;00m

计算依赖关系 - // - - / | - / \ | \ \ | | - - - | | - | - - | | - - - | | | - - | | - - | | | - - | | - | | | - - - - | - | - / / | //--\| | \-| \ \ - - / \ / / / - - \ | - / / - \ \ / \ / | | | | - | \ - - - / / - / \ - \ | | \-| - / - - \ \ \ - \ - - | \ | // \ - / | | - - | \ | / \ \ // - | \ \ / | / - \ | - / / \ - / - / | - | / | - | / - \ / \ | //\/| \ / \ / \ / | - | - \ - - / \ | - - - \\ | | - / \ \ / / - \ / \ - | | \ - / / / / \ / - - - | - - - | | | / - / \ \ | \ / \ / - - | | \ - \ \ - | \ | / | | | | / \ \ / - \ - - \ \ \ / \ | \-| | - | //| \ - \ - - / / \ - - - | - | | - | | | - | | \ / | | - / | / / / / \ / / / / \ - / - \ - \ \ | // - \ / - // | \ // / - / - | / - \ - / - | / | | \ \ | | - \ // / / \ - \ | | - - / / - | | \ // | | | - | | | \ / - / / \ | \ \ / \ - | - | | \ \ / / \ / - \ \ - \ - - \ / \ / / / / - - \ - | \ | | | / \ - - - / \ - | | \ / | | \ / \ - - | - \ / \ / | \ / | | \ // - / \ | - | - | - \ - - | / \ / / - | | - | - - | | - - | \ \-| \ \ \ / | / \ / \ \ / / - / - | / | | | - \ | - / | \ / | / | - \ | //-\| - \ | / | / \ - \ - - | //\| \ | - / | | / | - - \ | //| - | \ \ / - - - | \ / - - \ - \ - \ - / - \ \ \ \ /| - | | / \ / / / | \ \ / | | | \ | | \ // - \ | | | | \ / | \ | - / - / \ | - - / | - / / \ \ - / \ | \ / | / - \ / - - | - - / | | // - | - | \ \ \ / \ / / / | - | - | - | - - | | \ \ \ | - \ - / - / - / \ \ / - - \ - \ - / - | \ \ | / - / / - - / | / \ / / | \ | - / | \ | \ \ - \ / \ - \ // | - \ - \ \ | / - - / \ | \ \ \ / \ - // | - / \ \ \ - - \ - | - / / / - / / / - \ | / \ | | //\/| //| | | | | / \ / \ / \ | - - \ / \ / \ | \ \ - - | \ - / - | / \ / \ / / / - / / \ / / | / | / /... 完毕! [[32mebuild[39;49;00m
[36;01mU[39;49;00m ] [32msys-libs/glibc-2.21-r1[39;49;00m [34;01m[2.20-r2][39;49;] 00m [[32mebuild[39;49;00m
[36;01mU[39;49;00m ] [32mdev-libs/elfutils-0.163[39;49;00m [34;01m[0.158][39;49;00m][39;49;00m] 32mebuild[39;49;00m [32;01mN[39;49;00m ] [32mdev-qt/linguist-tools-5.4.2[39;49;00m USE="[34;01m-debug[39;49;] 00m [34;01m-qml[39;49;00m {[34;01m-test[39;49;00m}]" [[32mebuild[39;49;00m
[36;01mU[39;49;00m ] [32mmedia -libs/libsdl-1.2.15-r9[39;49;00m [34;01m[1.2.15-r8][39;49;00m [[32;01mebuild[39;49;00m
[36;01mU[39] ;49;00m ] [32;01mnet-p2p/传输-2.84-r3[39;49;00m [34;01m[2.84][39;49;00m USE="[33;01mqt5[39;49;00m%“ [[32mebuild[39;49;00m [36;01mU[39;49;00m ] [32mnet-无线/bluez-5.35[39;49;00m [34;01m[5.33][39;49;00m][[ 32mebuild[39;49;00m [36;01mU[39;49;00m ] [32mx11-驱动程序/nvidia-drivers-355.11-r2[39;49;00m [34;01m[340.93-r1][39;49; 00m 使用=“[33;01mgtk2[39;49;00m%” [33;01mgtk3[39;49;00m%*" [[32;01mebuild[39;49;00m
[36;01mU[39;49;00m]] [32;01mdev-vcs/git-2.4.10[39; 49;00m [34;01m[2.4.9][39;49;00m

现在我想使用这个文本,所以我需要“原始文本”版本。如何清除这些混乱的文本?

答案1

执行此特定操作的最简单方法是在用于生成该输出的任何工具中禁用颜色输出。

现在,在我看来,这是 Gentoo 的emerge。这手册页因为这告诉我还有一个--color < y | n >选择。因此,使用 再次运行它--color n

相关内容