Global change of ip

Justin T Pryzby justinpryzby at users.sourceforge.net
Fri Oct 31 22:53:51 UTC 2008


On Fri, Oct 31, 2008 at 01:23:17PM -0700, Scott Haneda wrote:
> I have an A record change that needs to happen across many zones. I  
> have the old ipand of course the new ip. Can someone help me with a  
> command to find and replace across multiple files please.
> 
> I also will need to do a serial update as well, and that could be any  
> number and not cinsistant.
I can suggest starting with something like this; note that sed -i
modifies the files *in place* so work on a spare copy and diff
afterwards.

sed -i~ -se 's/\<OLDIP\>/\<NEWIP\>/' \
    -e "/^@[[:space:]]*[[:digit:]]*[[:space:]]*[A-Z]*[[:space:]]*/{ :l; /)/ !  {N; b l}; /)/ ! {s/.*/unterminated SOA\n&/;q3}; s/(\([[:space:]]*\)[0-9]*/\1`date +%Y%m%d`00/}" ZONEFILES

Justin


More information about the bind-users mailing list