Because the DNS records were manually written before using the DNS admin background, the recording format was a bit messy.
Now organize your DNS records in a format (a record and CNAME record):
Domain TTL type data
Www.baidu.com 1800 A 127.0.0.1
#!/bin/bashfilelist= ' ls | grep "^named" ' basedir= ' pwd ' resdir= "$basedir"/DNSDATA/RM -RF "$resdir" mkdir "$resdir" for file in $filelistdoworkdir = "work/' echo " $File " | sed s/named.//g ' "rm -rf " $workdir "mkdir " $workdir " -psed -n " 1,8p ' $File > $workdir/$File .headsed -n ' 9, $p ' ' $File ' > ' $workdir "/" $File ".lastcd " $workdir " &> /dev/nullegrep -v ' ^$|^; ' "$File" .last > "$File" .datagrep -we "A" "$File" .data | sed ' s /in//g ' | sort | uniq | sort -rn | awk ' nf == 3 {print $1 "\t1800\t" $ "T" $ > "$File". agrep -we "A" "$File" .data | sed ' s/in//g ' | sort | uniq | sort -rn | awk ' nf != 3 {priNt $1 "\t1800\t" $ "\ T" $4} ' >> "$File". agrep -we "NS" "$File" .data | sed ' s/in//g ' | sort | uniq | sort -rn > "$File". nsgrep -we "CNAME" "$File" .data | sed ' s/in//g ' | sort | uniq | sort -rn | awk ' nf == 3 {print $1 ' \t1800\t "$" \ T "$" > "$File". cnamegrep -we "CNAME" "$File" .data | sed ' s/in//g ' | sort | uniq | sort -rn | awk ' nf != 3 {print $1 "\t1800\t" $ "\ T "$4} ' >> " $File ". cnamecat "$File" .head > "$File" .rescat "$File". ns >> "$File" .rescat "$File". a >> "$File" .rescat "$File". cname >> "$File" .rescp -a "$File" .res "$resdir" cd - &> /dev/nullrm -fr "$workdir" done
Put the above script in the record path to execute, the collated record file is placed in the dnsdata.
This article is from the "Do not forget Beginner's mind" blog, please be sure to keep this source http://winterysea.blog.51cto.com/9677346/1708247
DNS Records collation