Highlight a single word *always* in a terminal
Is there a terminal emulator (like GNOME terminal) for linux/unix out there, which allows for highlighting a single word always (such as "highlight the word FAIL in red")? Or maybe is there a plugin for the GNOME terminal (if such a thing like "plugins for the gnome-terminal" exists).
The solution should highlight the word regardless of what application is being run inside the terminal, i.e. running cat test.txt
should highlight the word as well as make all
.
Any help is greatly appreciated by my bleary-eyed eyes.
Solution 1:
Using bash, you can highlight all the word 'FAIL' in red using the following commands:
txtred=$(echo -e '\e[0;31m')
txtrst=$(echo -e '\e[0m')
bash | sed -e "s/FAIL/${txtred}FAIL${txtrst}/g"
What it does is creating a new bash shell and editing stdout of this new shell using sed
. If you want to end the stdout edition, simply type exit
to return back to your previous shell. You can find more color commands here. The echo -e
variation is needed to get the real ESCAPE value of \e
.
I tried it with echo
and cat
in this subshell and it is working. However, it breaks programs expecting a terminal as their output like vi
. I guess that it would also break programs using special output buffering. It is also breaking commands like echo -n FAIL
and change the behavior of commands like ls
(ls prints many files per line when the output is a terminal, and one file per line when the output is a pipe).
Solution 2:
clide works fine. I use it on RHEL 6.2, from the EPEL repository