# Intended purpose: Pipe birdc s p all into this script
# initialize variable
BEGIN {
if (!pref) {
pref="^p_";
}
if (print_info=="") {
print_info=0;
}
proto="";
print "
Peer | type | state | ";
if (print_info == 1) {
print "Info | ";
}
print "
";
#rowspan='2'
# print "imported | exported | preferred |
";
}
END {
print "
";
}
# default output for birdc, filter
$1=="BIRD" || $1=="Name" {
next
}
# if line begins with dn and is a BGP line
$0 ~ pref && $2=="BGP" {
proto=$1
print "" $1 " | " $2 " | " $4 " | ";
if (print_info == 1) {
print "" $6 " | ";
}
print "
";
#rowspan='2'
next
}
# for every other line "starting" a protocol
/^[a-zA-Z]/ {
# reset proto
proto=""
next
}