1

Using sed to color the output from a command on solaris

view story
linux-howto

http://unix.stackexchange.com – I have a ksh script that must work on both linux and solaris. I'm trying to color the output of specific commands. It works on linux (specifically RHEL6), but not on solaris (SunOS 5.10). Command on linux (the output "test" is correctly colored red): [amartin@linuxbox:~]$ echo "test" | sed 's,.*,\x1B[31m&\x1B[0m,' test Command on solaris (the output "test" is not colored): [amartin@sunbox:~]$ echo "test" | sed 's,.*,\x1B[31m&\x1B[0m,' x1B[31mtestx1B[0m Is there a way to craft this command such that the output is red, without the raw codes in the output? I can't change the 'ec (HowTos)