DNS Records collation

Source: Internet
Author: User


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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.