I am trying to find aws arn from logs and change its color
regex I tried
echo 'arn:aws:lambda:us-east-2:421142534505:function:list-users"' | sed -e "s/arn:\S*[^\s\"]/$(tput bold setaf 1)&$(tput setaf 9)/gi"
result I got
I want arn:aws:lambda:us-east-2:421142534505:function:list-users
to be colored (any whitespace or " should not be colored)
CodePudding user response:
Using sed
$ sed "s/arn:aws[^\" ]*/$(tput setaf 1)&$(tput sgr 0)/g" input_file