Removing DNS line from all files

DJVG

Verified User
Joined
Aug 14, 2008
Messages
25
Hi All,

I added one extra DNS line (NS) before a datacenter move.
Now I want to remove that DNS line from all .db files.
I know how to remove a line with perl, but I have trouble removing the return after that line.

Is there a way to remove one line and the return?

Regards,
Daan
 
Try this code instead of your Perl method:

Code:
/bin/sed -e '/[B]ns3.mydns.com[/B]/d' -i /var/named/*.db

Afterwards, you should run the following to rebuild the domain zonefiles:

Code:
echo "action=rewrite&value=named" >> /usr/local/directadmin/data/task.queue

Note: You must change ns3.mydns.com to match the server hostname of your extra NS record that you want removed.
 
Hi czotos,

Thanks for sharing your solution, works perfect!

Thank you very much :-)

Regards,
Daan
 
Also ... I believe that extra blank lines in the zone files are not a problem. Look at the files in your shell and you'll see that there are plenty of them.

Jeff
 
Back
Top