1

I used script to dump output of some other script to file. While it worked great, the output was formatted(colours, etc.), so now it's unreadable as a raw text - I have to use cat or less instead. The code looks like this:

[32mThese are the packages that would be merged, in order:[39;49;00m

Calculating dependencies - / / - - / | - / \ | \ \ | | - - - | | - | - - | | - - - | | | - - | | - - | | | - - | | - | | | - - - - | - | - / / | / / - - \ | | \ - | \ \ - - / \ / / / - - \ | - / / - \ \ / \ / | | | | - | \ - - - / / - / \ - \ | | \ - | - / - - \ \ \ - \ - - | \ | / / \ - / | | - - | \ | / \ \ / / - | \ \ / | / - \ | - / / \ - / - / | - | / | - | / - \ / \ | / / \ / | \ / \ / \ / | - | - \ - - / \ | - - - \ \ | | - / \ \ / / - \ / \ - | | \ - / / / / \ / - - - | - - - | | | / - / \ \ | \ / \ / - - | | \ - \ \ - | \ | / | | | | / \ \ / - \ - - \ \ \ / \ | \ - | | - | / / | \ - \ - - / / \ - - - | - | | - | | | - | | \ / | | - / | / / / / \ / / / / \ - / - \ - \ \ | / / - \ / - / / | \ / / / - / - | / - \ - / - | / | | \ \ | | - \ / / / / \ - \ | | - - / / - | | \ / / | | | - | | | \ / - / / \ | \ \ / \ - | - | | \ \ / / \ / - \ \ - \ - - \ / \ / / / / - - \ - | \ | | | / \ - - - / \ - | | \ / | | \ / \ - - | - \ / \ / | \ / | | \ / / - / \ | - | - | - \ - - | / \ / / - | | - | - - | | - - | \ \ - | \ \ \ / | / \ / \ \ / / - / - | / | | | - \ | - / | \ / | / | - \ | / / - \ | - \ | / | / \ - \ - - | / / \ | \ | - / | | / | - - \ | / / | - | \ \ / - - - | \ / - - \ - \ - \ - / - \ \ \ \ / | - | | / \ / / / | \ \ / | | | \ | | \ / / - \ | | | | \ / | \ | - / - / \ | - - / | - / / \ \ - / \ | \ / | / - \ / - - | - - / | | / / - | - | \ \ \ / \ / / / | - | - | - | - - | | \ \ \ | - \ - / - / - / \ \ / - - \ - \ - / - | \ \ | / - / / - - / | / \ / / | \ | - / | \ | \ \ - \ / \ - \ / / | - \ - \ \ | / - - / \ | \ \ \ / \ - / / | - / \ \ \ - - \ - | - / / / - / / / - \ | / \ | | / / \ / | / / | | | | | / \ / \ / \ | - - \ / \ / \ | \ \ - - | \ - / - | / \ / \ / / / - / / \ / / | / | / /... done! [[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 [[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/transmission-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-wireless/bluez-5.35[39;49;00m [34;01m[5.33][39;49;00m [[32mebuild[39;49;00m [36;01mU[39;49;00m ] [32mx11-drivers/nvidia-drivers-355.11-r2[39;49;00m [34;01m[340.93-r1][39;49;00m USE="[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

Now I want to use this text, so I need "raw text" version. How can I clean text from this mess?

terdon
  • 242,166
MatthewRock
  • 6,986

1 Answers1

2

The easiest way to do this specific thing is to disable color output in whatever tool you used to generate that output.

Now, it seems to me that this is Gentoo's emerge. The man page for that tells me there's a --color < y | n > option. So run it again with --color n.

faho
  • 1,253