From owner-freebsd-isp Mon Dec 18 2:53:11 2000 From owner-freebsd-isp@FreeBSD.ORG Mon Dec 18 02:53:10 2000 Return-Path: Delivered-To: freebsd-isp@freebsd.org Received: from coltbe178.colt-telecom.be (colt-telecom.customer.BE.COLT.NET [212.35.96.130]) by hub.freebsd.org (Postfix) with ESMTP id 7261837B402 for ; Mon, 18 Dec 2000 02:53:09 -0800 (PST) Received: from coltbeexch01.colt-telecom.be (unverified) by coltbe178.colt-telecom.be (Content Technologies SMTPRS 4.1.5) with ESMTP id ; Mon, 18 Dec 2000 11:59:24 +0100 Received: by COLTBEEXCH01 with Internet Mail Service (5.5.2650.21) id ; Mon, 18 Dec 2000 11:51:35 +0100 Message-ID: From: Livens Wim To: 'Dave Wilson' , freebsd-isp@FreeBSD.ORG Subject: RE: Off topic - shell skills Date: Mon, 18 Dec 2000 11:51:27 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="iso-8859-1" Sender: owner-freebsd-isp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > 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