I am trying to change the colors of content of a file conditionally. My file is:
A B C D
Value Value Value Value
Value Value Value Value
Value Value Value Value
Value Value Value Value
My command is cat file4 | sed "s,.*,${esc}[33m&${esc}[0m,", whose logic I understand to be:
- Cat the file then by sed command edit the contents color by using the ANSI color codes.
But when I run this file generated is not as per desired:
[33mA B C D[0m
[33mValue Value Value Value [0m
[33mValue Value Value Value [0m
[33mValue Value Value Value [0m
[33mValue Value Value Value [0m
Desired Output:
- Field A should be red.
- Field C should be in blue.
- Field D should be yellow.
- Field B should be green.