TTL record changes in All domains

Stephane Bortzmeyer bortzmeyer at
Tue Jul 17 11:19:30 UTC 2007

On Tue, Jul 17, 2007 at 12:42:04PM +0200,
 Adam Tkac <atkac at> wrote 
 a message of 22 lines which said:

> I don't know about any utility but I think you could write simple bash 
> script (something like this example)
> for zone in `find zones`; do
>   cat "${zone}" | sed 's/$TTL.*/$TTL 2D/' > "${zone}.new"
>   mv "${zone}.new" "${zone}"
> done

Warning, if there is a bug in the sed script, this will destroy the
old file with a new and empty one, without remorse.

Perl may be a better idea, specially since it keeps a backup:

perl -i.bak -p -e 's/^ *\$TTL *(.*)$/\$TTL 2D/' `find zones`

-i : keeps a backup
-p : loops over the original file
-e : executes this instruction

s/.../.../ : substitutes the new TTL 

More information about the bind-users mailing list