summaryrefslogtreecommitdiff
path: root/other_scripts/bird2.awk
diff options
context:
space:
mode:
authoruvok cheetah2025-02-02 14:58:44 +0100
committeruvok cheetah2025-02-02 14:58:44 +0100
commit6078935504c752afebefd8e570a6f29f6b05bcdb (patch)
treed46c641beac6db0f20e977a5a6d2d6c07cb48615 /other_scripts/bird2.awk
parent49f947a17f51253eb8a8dee3dab3687ec45d90f5 (diff)
Various bird stuff (awk)
Diffstat (limited to 'other_scripts/bird2.awk')
-rw-r--r--other_scripts/bird2.awk29
1 files changed, 29 insertions, 0 deletions
diff --git a/other_scripts/bird2.awk b/other_scripts/bird2.awk
new file mode 100644
index 0000000..f61a35c
--- /dev/null
+++ b/other_scripts/bird2.awk
@@ -0,0 +1,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
+}