tail -f myfile.log | perl -pe 's/.*TEXT_TO_FIND.*/\e[1;31m$&\e[0m/g'
\e[1;31m
will give you the red color. If you would like some yellow, use \e[1;33m
, and for green use \e[1;32m
. The \e[0m
restores the normal text color.SOURCE: http://unix.stackexchange.com/questions/8414/how-to-have-tail-f-show-colored-output
(Answer <37>)
0 comments:
Post a Comment