kintarooe
March 27th, 2010, 06:36 AM
I am building a script to modify dns zone files and am having difficulties. I am trying to find/replace certain lines with updated information. Any help is welcome.
Here is a default zone.
$TTL 1200
@ IN SOA ns1.where.net. webmaster.somewhere.com. (
2008112501 ; serial
1200 ; refresh
7200 ; retry
604800 ; expire
1200 ; ttl
)
@ IN NS ns1.where.net.
@ IN NS ns1.where2.net.
@ IN MX 1 mail
mail IN MX 1 mail
test.com. IN A 2.2.2.2
www IN CNAME test.com.
mail IN A 1.1.1.1
I am trying to use sed to replace the lines after the first mail occurance as each line could be different.
Here is a default zone.
$TTL 1200
@ IN SOA ns1.where.net. webmaster.somewhere.com. (
2008112501 ; serial
1200 ; refresh
7200 ; retry
604800 ; expire
1200 ; ttl
)
@ IN NS ns1.where.net.
@ IN NS ns1.where2.net.
@ IN MX 1 mail
mail IN MX 1 mail
test.com. IN A 2.2.2.2
www IN CNAME test.com.
mail IN A 1.1.1.1
I am trying to use sed to replace the lines after the first mail occurance as each line could be different.