Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

How to remove a few DNS records from all zone files?

Discussion in 'Bind/DNS/Nameserver' started by postcd, Apr 27, 2014.

  1. postcd

    postcd Well-Known Member

    Joined:
    Oct 22, 2010
    Messages:
    689
    Likes Received:
    14
    Trophy Points:
    68
    Hello,

    WHM stupidly without asking me added all Default nameservers into zone files of accounts i transfered to my server.

    The aim is now fix the mess WHM did.

    Removing whole entry lines

    nsx1.hosting.com X X X IP
    nsx2.hosting.com X X X IP

    there is more than 100 zone files to edit. so i ask how i can remove these two whole lines automatically via linux command line from all zone files.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. cPanelPeter

    cPanelPeter Technical Analyst III
    Staff Member

    Joined:
    Sep 23, 2013
    Messages:
    575
    Likes Received:
    20
    Trophy Points:
    93
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    You could use the replace command. First if you haven't already done so, make a backup of the /var/named directory

    Code:
    cp -rfpd /var/named /var/named.bak
    
    Then you would use the replace command something like this:

    Code:
    replace 'nsx1.hosting.com X X X IP' '' -- *
    replace 'nsx2.hosting.com X X X IP' '' -- *
    
    That should do the trick. If anything goes wrong, you still have the backup.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice