in reply to How to replace the DNS zone file TTL for 300+ zone files

Learn Perl. Learn to use CPAN. You can roll your own codes, but most likely there's someone else that has done it already.

use strict; use warnings; use IO::File; use DNS::ZoneParse; my @zonefiles = </path/to/zonefile/*>; foreach my $zonefile (@zonefiles) { my $z = DNS::ZoneParse->new($zonefile); # change ttl in all MX records, for example my $mx = $z->mx; $_->{ttl} = 'foo bar' for (@$mx); # update ttl $z->new_serial(); # write the new zone file to disk my $zf = new IO::File "$zonefile", "w" or die "Error writing zonefile: $!"; print $zf $z->output(); }