#!/bin/sh

# Example program to show how one might compare a legacy, hand-crafted, zone
# with a newly generated zone.

OLD=/var/named/cibernet.com..zone
NEW=INTERNAL.cibernet.com
DOMAIN=cibernet.com.

canonzone $DOMAIN		<$OLD	|
	grep "IN A"			|
	awk '{ print $4 " " $0 }'	|
	sortbyip |cut -d" " -f2-	> old.txt

canonzone $DOMAIN		<$NEW	|
	grep "IN A"			|
	awk '{ print $4 " " $0 }'	|
	sortbyip |cut -d" " -f2-	> new.txt

echo Lines only in $OLD:
echo "     " comm -23 old.txt new.txt
echo Lines only in $NEW:
echo "     " comm -13 old.txt new.txt
echo Lines different in each:
echo "     " comm -3 old.txt new.txt
