Edit dns records with sed or vi (search and replace)
You can easily replace an existing IP with and new IP in a dns record using sed. Here is the way
you do it.
sed -e ’s#xx.xx.xx.xx#yy.yy.yy.yy#g’ domain.com > new.domain.com
where xx.xx.xx.xx is the existing IP and yy.yy.yy.yy is the new IP
Using vi is similar. Here is the syntax:
vi yourzone.com . For instance, to change IP addresses:
<ESC>
:%s/xxx.xxx.xxx.xxx/yyy.yyy.yyy.yyy/g (where xxx is original IP and yyy is new IP)
<ESC> ZZ (to save file)
Categories: sysadmin
Comments (0)
Trackbacks (0)
Leave a comment
Trackback