Easy question

John N Dvorak dvorak at capu.net
Sat Nov 6 22:24:39 UTC 1999

There are many ways to do this.  You have probably already received an
awk/sed solution using substitution, but I thought I would throw out a
Perl5 solution for those who like command-line Perl tools.

Here's a line that will back up all the files while it replaces the
content (replace perl with perl5 as necessary):

perl -i.bak -pe 's/oldnameserver/newnameserver/g' /var/named/db*

This will look for all instances of oldnameserver and replace it with

Your old files will be backed up with .bak extensions, but you can change
this to your liking.

Just one more way to do it :)


On Fri, 5 Nov 1999, Alex wrote:

>Can someone tell me how I can replace 1 line of text in 290 db files?  Is
>there some sort of grep command or vi command that will recursively go thru
>each db.domain.com file in my /var/named dir and replace a current name
>server with a new name server?
>Please email me if you know!

John N Dvorak | dvorak at capu.net
Director of Technology
CapuNet, LLC - Corporate Internet Solutions
(301) 881-4900 x8018

More information about the bind-users mailing list