Skip to content

Instantly share code, notes, and snippets.

@mjf
Created August 3, 2012 08:02
Show Gist options
  • Save mjf/3245634 to your computer and use it in GitHub Desktop.
Save mjf/3245634 to your computer and use it in GitHub Desktop.
Add IPv6 default route to the output of sipcalc(1)
#! /usr/bin/awk -f
# Add IPv6 default route to the output of sipcalc(1)
# Copyright (C) 2009 Matous Jan Fialka, <http://mjf.cz/>
# Released under the terms of The MIT License
#
# Assumes last usable IPv6 address as default route.
#
# Usage: sipcalc <net>[/<mask>] | sipcalc-add-ipv6-default-route.awk
/^Network range/ {
route = $4
}
! $1 {
if (seen_blank)
next
seen_blank = 1
}
/^-$/ {
printf("Default route (gateway)\t- %s\n",
substr(route, 1, length(route) - 1) "1")
}
{ print }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment