Date: Wed, 23 Jan 2002 11:43:12 -0800 From: Matthew Hunt <mph@astro.caltech.edu> To: Eric Six <erics@sirsi.com> Cc: questions@FreeBSD.ORG Subject: Re: Text editiing.... possibility for perl? Message-ID: <20020123114312.A40013@wopr.caltech.edu> In-Reply-To: <DC32C8CEB3F8D311B6B5009027DE5AD503D207BB@stlmail.dra.com>; from erics@sirsi.com on Wed, Jan 23, 2002 at 01:34:27PM -0600 References: <DC32C8CEB3F8D311B6B5009027DE5AD503D207BB@stlmail.dra.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jan 23, 2002 at 01:34:27PM -0600, Eric Six wrote: > 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 There's more than one way to do it. Here are two. perl -pe 's/,/-/; s/,/\t/; s/,/\t/; s/,/\t/; s/,/./g;' infile > outfile perl -ne 'chomp; @a=split /,/; print "$a[0]-$a[1]\t$a[2]\t$a[3]\t$a[4].$a[5].$a[6].$a[7]\n"' infile > outfile -- Matthew Hunt <mph@astro.caltech.edu> * UNIX is a lever for the http://www.pobox.com/~mph/ * intellect. -J.R. Mashey To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020123114312.A40013>