#!/bin/bash
echo "
Peer | type | state |
";
/usr/sbin/birdcl -r s p | while read -r line; do
outp=$(echo "$line" | /usr/bin/awk -v print_info=0 -v pref='^p_' -f /root/bird2.awk)
if [[ -z "$outp" ]]; then
continue
fi
echo "$outp"
protocol=$(echo "$line" | awk -e '{ print $1; }')
outp=$(birdcl -r "show route where bgp_large_community ~ [(CLEARNET_ASN, LC_FILTERED, *)] protocol ${protocol} table t_myas_unfiltered count" | grep t_myas_unfiltered | grep -E -o "[1-9][0-9]* of [0-9]+ routes")
if [[ -n "$outp" ]]; then
echo " | filtered ${outp} |
"
else
echo " | no filtered routes |
"
fi
done
echo "
"