From 6078935504c752afebefd8e570a6f29f6b05bcdb Mon Sep 17 00:00:00 2001 From: uvok cheetah Date: Sun, 2 Feb 2025 14:58:44 +0100 Subject: Various bird stuff (awk) --- other_scripts/birdroutes.awk | 48 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 other_scripts/birdroutes.awk (limited to 'other_scripts/birdroutes.awk') diff --git a/other_scripts/birdroutes.awk b/other_scripts/birdroutes.awk new file mode 100644 index 0000000..615917a --- /dev/null +++ b/other_scripts/birdroutes.awk @@ -0,0 +1,48 @@ +# 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 ""; + if (print_info == 1) { + print ""; + } + print ""; + #rowspan='2' +# print ""; +} +END { + print "
PeertypestateInfo
importedexportedpreferred
"; +} + + +# 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 +} -- cgit v1.2.3