Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- ASN="64828"
- # welcome to the quoting hell
- echo "digraph dn42_v4 {" &&
- echo " concentrate = true;" &&
- echo "show route primary all where source = RTS_BGP" | birdc -r | awk "
- \$1 == \"BGP.as_path:\" {
- printf(\" $ASN\");
- for (i = 2; i <= NF; i++ ) {
- if (j != \$i) {
- printf(\" -> %s\", \$i);
- j = \$i
- }
- }
- if (j != \$NF) {
- printf(\" -> %s;\n\", \$NF)
- } else {
- printf(\";\n\")
- }
- }" | sort -u &&
- echo "}"
Add Comment
Please, Sign In to add comment