gawk - How to print awk's results with different colors for different fields? -


this file has 3 fields. wanted e.g. first 2 fields in green, , third in white (nb : black background), tried :

awk '{print "\033[0;32m"$1"\033[0m", "\033[0;32m"$2"\033[0m", "\033[0;37m"$3"\033[0m"} }' chrono.txt 

and green…

how must proceed (if possible) ?

to color output awk, can use approach.

function red(s) {     printf "\033[1;31m" s "\033[0m " }  function green(s) {     printf "\033[1;32m" s "\033[0m " }  function blue(s) {     printf "\033[1;34m" s "\033[0m " }  {     print red($1), green($2), blue($3) } 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -