Ondřej Plátek Archive
PhD candidate@UFAL, Prague. LLM & TTS evaluation. Engineer. Researcher. Speaker. Father.

Color through pipe used by less

The 'less' command is necessity for longer output.
Color is really neat.
How can I combine color and less?
 grep --color=always pattern *yourfiles*.txt |less -r 
The flag -r tells the less command to interpret the escape sequences for colors and on the other side we have to tell the command to push the color escape sequences even through pipeline! The default behaviour is to turn off the colors when sending the colors to pipeline, so I used --color=always to enforce the colors.