summaryrefslogtreecommitdiff
path: root/other_scripts/bird2.awk
blob: f61a35cb8415c5380c30e9020e12a5935b202e8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Intended purpose: Pipe birdc s p all into this script - line by line / protocol by protocol

# initialize variable
BEGIN {
  if (!pref) {
    pref="^p_";
  }

  proto="";
}

# 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 "<tr><td>" $1 "</td><td>" $2 "</td><td>" $4 "</td></tr>";
  next
}

# for every other line "starting" a protocol
/^[a-zA-Z]/ {
  # reset proto
  proto=""
  next
}