-
-
Save franleplant/7aa081595a9dce348af8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ echo line 1: PASS; echo line 2: FAIL; } | | |
awk -v "red=$(tput setaf 1)" -v "green=$(tput setaf 2)" \ | |
-v "reset=$(tput sgr0)" ' | |
{ for (i = 1; i <= NF; i++) { | |
if ($i == "FAIL") printf "%s", red "FAIL" reset; | |
else if ($i == "PASS") printf "%s", green "PASS" reset; | |
else printf "%s", $i | |
if (i == NF) printf "%s", ORS | |
else printf "%s", OFS | |
}}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment