#!/bin/bash # # generic_to_txt, takes a tinydns zone file as an argument, and # converts all generic (TXT) records contained therein to standard TXT # record format. # # Copyright Michael Orlitzky # # http://michael.orlitzky.com/ # # Released under the WTFPLv2. # # http://sam.zoy.org/wtfpl/COPYING # EXIT_SUCCESS=0 EXIT_NOT_ENOUGH_ARGS=1 if [ $# -lt 1 ]; then echo 'Usage:' echo '' echo " $0 " echo '' echo 'Takes a tinydns-data file as an argument, and replaces all' echo 'generic-syntax TXT records with standard-format ones.' echo '' exit $EXIT_NOT_ENOUGH_ARGS fi INFILE=$1 TMPFILE=${1}.tmp mv $INFILE $TMPFILE sed -r "s/^:(.*?):16:\\\036/'\1:/g" $TMPFILE > $INFILE if [ $? -eq $EXIT_SUCCESS ]; then rm $TMPFILE exit $EXIT_SUCCESSS fi