This question is inspired by this one on SU. How can I print bold or color using lp and ANSI escape sequences? I know how to display, for example, bold text in the terminal:$ echo -e '\033[01;1mthis text will be bold\033[00;0m,this will not' this text will be bold,this will notHowever, when I pipe this directly to lp I get a file that looks like this:01;1mthis text will be bold00;0m,this will notSo, I figure the way to do this would be to use groff to create a postscript file and print that. It looks like groff should be able to do this, I know it can correctly convert a man page to a ps file and keep whatever is bold in the man page bold in the postscript. However, the groff documentation is enormous and kind of esoteric to someone with no postscript experience. I have tried various combinations of options, all of which result in a postscript file that looks like the line above:echo  -e '\033[01;1mthis text will be bold\033[00;0m,this will not' | groff >a.psecho  -e '\033[01;1mthis text will be bold\033[00;0m,this will not' | groff -c >a.psecho  -e '\033[01;1mthis text will be bold\033[00;0m,this will not' | groff -Pc >a.psecho  -e '\033\[01;1m\]this text will be bold\033\[00;0m\],this will not' | groff -Tascii >a.ps echo  -e '\033[01;1mthis text will be bold'| groff -man >a.ps echo  -e '\033[01;1mthis text will be bold'| groff -mdoc >a.ps echo  -e '\033[01;1mthis text will be bold'| groff -me >a.psecho  -e '\033[01;1mthis text will be bold'| groff -mm >a.psecho  -e '\033[01;1mthis text will be bold'| groff -ms >a.psSo, how can I use lp and groff or any other tool combination to print bold or colored text from the terminal?
Can groff create a ps file with interpreted ANSI escape characters?
printing;escape characters;groff;lp
That's more the reverse of what groff is designed to do.What you're looking for can be achieved at least with this combination of tools:ahawkhtmltopdfpdf2ps from ghostscriptLike:printf '\e[31;1mfoo\e[mbar\n' |  aha |  wkhtmltopdf - - |  pdf2ps - output.psA bit overkill but it does the trick. You can probably skip the last part as PDF is as easily printed as postscript nowadays:printf '\e[31;1mfoo\e[mbar\n' |  aha |  wkhtmltopdf - output.pdfOr you can feed it directly to lp for printing.