LINUX.ORG.RU

История изменений

Исправление gh0stwizard, (текущая версия) :

echo -e "string1\nerror\nsuccess\nstring2\nfail\nMaker1: value1\nMaker2: value2" | \
perl -p \
-e 's/(success)/\e[32m$&\e[0m/g;' \
-e 's/(error|fail)/\e[31m$&\e[0m/g;' \
-e 's/(Maker1:) (.*)/$1 \e[36m$2\e[0m/m;' \
-e 's/(Maker2:) (.*)/$1 \e[01;34m$2\e[0m/m;'

Исходная версия gh0stwizard, :

echo -e "string1\nerror\nsuccess\nstring2\nfail\nMaker1: value1\nMaker2: value2" | \
perl -p -e 's/(success)/\e[1;10;32m$&\e[0m/g;' \
-e 's/(error|fail)/\e[0;10;31m$&\e[0m/g;' \
-e 's/(Maker1:) (.*)/$1 \e[1;10;32m$2\e[0m/m;'