Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 08-17-2004, 08:41 AM   #1
LQ Newbie
Registered: Nov 2003
Location: near DC, USA
Distribution: Slackware 9.1
Posts: 14

Rep: Reputation: 0
changing SOAs in named with large numbers of zone files

Hi, I have a DNS server running on my redhat ES2.1 box with lots of zone files. I recently decided to change the expire and minimum time limits on all of the files. I was wondering if there’s a better way to change the 400 files or so other then going through each file and individually changing every record. Thanks for your time.
Old 08-17-2004, 09:17 AM   #2
Registered: Dec 2003
Location: Northern VA
Posts: 493

Rep: Reputation: 30
Well, if all your files are uniform, such as my expire is set to 604800 and my minimum is set to 38400, these are all unique numbers within each file, you could do a sed to change them.

Something like this:


for i in `ls *.net`
sed -e 's/604800/666666/' \
-e 's/38400/33333/' $i > blah.tmp

mv blah.tmp $i

If they're not all uniform, then you can do something with head and tail and some echos...but hopefully the simple sed script will work for you.
Old 08-17-2004, 11:45 AM   #3
LQ Newbie
Registered: Nov 2003
Location: near DC, USA
Distribution: Slackware 9.1
Posts: 14

Original Poster
Rep: Reputation: 0
Thanks much. Thats exactly what i was looking for.
Old 08-17-2004, 02:35 PM   #4
Senior Member
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
A quick one-liner in Perl:
perl -pi -e 's/oldpattern/newpattern/g' zone*

This will modify them in place so make a backup copy of the files before you do this.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
DNS: Named.conf don point to zone file Swakoo Linux - General 3 09-27-2005 07:02 PM
named classless reverse zone jon3k Linux - Software 1 03-08-2005 09:57 PM
Problems with iptables and DNS/named Zone settings majiclab Linux - Networking 2 10-24-2004 05:27 AM
Bind/named can't open zone files for some reason adam_lang Linux - Networking 2 02-02-2004 09:09 PM
Changing time zone... tinaa Linux - General 3 07-11-2003 06:07 AM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:20 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration