Replace TXT record server wide

Petertjuh360

Verified User
Joined
Nov 7, 2010
Messages
349
Hello,

I need to replace each TXT record with the following entry:

Code:
"v=spf1 a mx ip4:135.20.51.235 ip6:3a51:7c9:baaf:2fe::1 ~all"

By:

Code:
"v=spf1 include:_spf.hosting.com ~all"

I found this article but I can't find out how to write the command. Can someone help me, please?

Thanks in advance!
Peter
 
Hello,

I have had a little experience with this and as long as the special characters are escaped it should not be a problem.

I have not tested it but something like the following should do it, assuming your domains are in /var/named:

Code:
cp -fdr /var/named /var/named.backup
perl -pi -e 's/"v=spf1 a mx ip4:135.20.51.235 ip6:3a51:7c9:baaf:2fe::1 ~all"/"v=spf1 include:_spf.hosting.com ~all"/' /var/named/*.db

There was a slightly closer, related article here too: http://help.directadmin.com/item.php?id=592
 
Back
Top