From owner-freebsd-questions Wed Jan 23 12:26:43 2002 Delivered-To: freebsd-questions@freebsd.org Received: from ns2.worldgatein.com (ns2.worldgatein.com [203.109.64.24]) by hub.freebsd.org (Postfix) with ESMTP id E3ED837B404 for ; Wed, 23 Jan 2002 12:26:36 -0800 (PST) Received: from rivendell.worldgatein.net (interoffice.worldgatein.net [203.109.64.31]) by ns2.worldgatein.com (Postfix) with ESMTP id 23332BDEC for ; Thu, 24 Jan 2002 01:11:10 +0530 (IST) Received: by rivendell.worldgatein.net (Postfix, from userid 1001) id 1EFA132609; Thu, 24 Jan 2002 01:21:24 +0530 (IST) Date: Thu, 24 Jan 2002 01:21:24 +0530 From: Devdas Bhagat To: questions@FreeBSD.ORG Subject: Re: Text editiing.... possibility for perl? Message-ID: <20020124012124.A52509@rivendell.worldgatein.net> Reply-To: Devdas Bhagat Mail-Followup-To: questions@FreeBSD.ORG References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from erics@sirsi.com on Wed, Jan 23, 2002 at 01:34:27PM -0600 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 23/01/02 13:34 -0600, Eric Six wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > I have a few questions.. I need to edit a few files with a bunch > text. I am creating forward and reverse zone file for a private > network and I want to automate this tedious process.. Here is what I > have. > > I create a basic template in excel, it is as follows; > > host15,1,in,a,10,50,15,1 > host15,2,in,a,10,50,15,2 > host15,3,in,a,10,50,15,3 > > > What I need done after this file is populated is make it look like > this; > host15-1 in a 10.50.15.1 > host15-2 in a 10.50.15.2 > host15-3 in a 10.50.15.3 > > So I need the first comma changed to a minus, the next two comma's a > tab, and the last three changed to periods. I can do some of this > with 'cut' but not everything I want to do... I figure I cannot be > the only one that has had to populate a massive amount of forward and > reverse files in bind.. I figure there might be a perl script for > this?? sed -e 's/,/-/' -e 's/./\t/ ....... Perl, I wrote my own for loops. #!/usr/bin/perl for ($i=0;$i<=255;$i++) { print "host15-$i 86400 IN A 10.50.15.$i\n"; } Modify for the reverse. Devdas Bhagat > > TIA > Eric > > Eric Six erics@sirsi.com > Network Specialist > SIRSI > v : 1.800.372.8527.356 > f : 314.993.8927 > > > -----BEGIN PGP SIGNATURE----- > Version: PGPfreeware 7.0.3 for non-commercial use > > iQA/AwUBPE8QHsbzOHaBcCrEEQJexwCgv3Zbw4opAinpt4xXJ9qqvx39ka0An2tW > olfZuwJuBjOi63J+P1sZg67l > =AD9h > -----END PGP SIGNATURE----- > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message