Archive

Archive for July, 2011

Bash search and replace ip script

July 30, 2011 Leave a comment

You can search and replace and IP address in bind (named.conf) or name server records with this script:

Assign values as indicated.

#!/bin/bash
x=`cat oldip`
a=`cat newip`
cmd=”sed -e”
$cmd “s#$x#$a#g” oldconfigfie > new.configfile

Advertisements
Categories: sysadmin