LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   changing SOAs in named with large numbers of zone files (https://www.linuxquestions.org/questions/linux-networking-3/changing-soas-in-named-with-large-numbers-of-zone-files-218730/)

untoldone 08-17-2004 08:41 AM

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.

Technoslave 08-17-2004 09:17 AM

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:

#!/bin/sh

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

mv blah.tmp $i
done

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.

untoldone 08-17-2004 11:45 AM

Thanks much. Thats exactly what i was looking for.

stickman 08-17-2004 02:35 PM

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.


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