Date: Mon, 18 Dec 2000 07:19:33 -0500 From: "Troy Settle" <troy@psknet.com> To: "Livens Wim" <WLivens@colt-telecom.be>, "'Dave Wilson'" <davew@sai.co.za>, <freebsd-isp@FreeBSD.ORG> Subject: RE: Off topic - shell skills Message-ID: <GIEHKBHPBGKJPNMBCOHFMECCCAAA.troy@psknet.com> In-Reply-To: <DFCEEAEE7285D411884200508BEF01E308ADA1@COLTBEEXCH01>
next in thread | previous in thread | raw e-mail | index | archive | help
Dave, As a future timesaver (because you will have to do this again someday), you might want to take the time now to eliminate all A records to mail, and set the following: mail IN CNAME mail.ISP.net. @ IN MX 10 mail.ISP.net. By doing this, you've dropped your editing needs to 1 line in 1 zone file. G'luck, -Troy ** -----Original Message----- ** From: owner-freebsd-isp@FreeBSD.ORG ** [mailto:owner-freebsd-isp@FreeBSD.ORG]On Behalf Of Livens Wim ** Sent: Monday, December 18, 2000 5:51 AM ** To: 'Dave Wilson'; freebsd-isp@FreeBSD.ORG ** Subject: RE: Off topic - shell skills ** ** ** > How do I write a shell script that will change: ** > ** > mail IN A 10.1.1.58 ** > ** > to: ** > ** > mail IN A 10.0.0.1 ** > ** > ** > ? ** > ** > I need this script to parse through each zone, so when it ** > finds "10.1.1.58" ** > in a zone it will change the "10.1.1.58" to "10.0.0.1". ** > Please help if you can. ** ** Just to give you an awk-alternative: pipe your zonefiles through this: ** ** awk '/10.1.1.58/ {if ($1=="mail"&&$2=="IN"&&$3="A") print ** $1"\t"$2"\t"$3"\t10.0.0.1"; else print $0;} !/10.1.1.58/ {print}' ** ** It's probably far from optimal but it will not just change *any* ** occurance ** of that ip address, as in the sed example; only the A records for hosts ** named "mail". ** ** -- ** Wim Livens ** Internet Engineer ** COLT Telecom ** Brussels ** ** ** ** To Unsubscribe: send mail to majordomo@FreeBSD.org ** with "unsubscribe freebsd-isp" in the body of the message ** ** To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-isp" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?GIEHKBHPBGKJPNMBCOHFMECCCAAA.troy>