Syntax highlighting: text
#!/bin/bash
IFS=$(echo -en "\n\b")
for security_group in sg-xxxxxxxxxxxxxx1 sg-xxxxxxxxxxxxxx2 ; do
for entry in $(aws ec2 describe-security-groups --group-id $security_group| jq -rS '.SecurityGroups[] | .IpPermissions[] | .IpRanges[] | "\(.Description) \(.CidrIp)"')
do
myarray="${entry}"
if [ "${security_group}" = "sg-07921490103c23aed" ] ; then
COLOR='\033[0;36m'
else
COLOR='\033[0;37m'
fi
echo "${myarray[0]} ${security_group} ${myarray[1]}" | awk "{printf \"$COLOR%-55s %-25s %-25s\\n\", \$1, \$2, \$3}"
done|sort -k1 -k2
done
IFS=$(echo -en "\n\b")