I am using FreeBSD with the csh shell. As an example, in the terminal / screen I get color output for ls (eg. ls -lGs). But when I pipe it through more (eg ls -lGs | more) the output has no colour. Is there a way to have more also display color?
I solved the problem in two steps.
First I set the environment varable CLICOLOR_FORCE in .cshrc to force output other then to TERM to also use colors, eg:
more has a command line option -R to output color sequences.
-R or --RAW-CONTROL-CHARS Like -r, but only ANSI "color" escape sequences are output in "raw" form. Unlike -r, the screen appearance is maintained cor- rectly in most cases. ANSI "color" escape sequences are sequences of the form:
These two combined gave me the desired results, so
ls -lGs | more -R
now displays the output in color.