From owner-freebsd-questions@FreeBSD.ORG Sun Feb 1 06:36:23 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 246CE16A4CE for ; Sun, 1 Feb 2004 06:36:23 -0800 (PST) Received: from lilzmailso02.liwest.at (lilzmailso02.liwest.at [212.33.55.24]) by mx1.FreeBSD.org (Postfix) with ESMTP id 890A043D55 for ; Sun, 1 Feb 2004 06:36:15 -0800 (PST) (envelope-from dgw@liwest.at) Received: from cm58-27.liwest.at ([212.33.58.27]) by lilzmailso02.liwest.at with esmtp (Exim 4.24) id 1AnIhp-0004b5-Gw; Sun, 01 Feb 2004 15:36:13 +0100 From: Daniela To: Marty Landman , questions@freebsd.org Date: Sun, 1 Feb 2004 15:30:31 +0000 User-Agent: KMail/1.5.3 References: <200402010138.44102.dgw@liwest.at> <6.0.0.22.0.20040131195217.01b138d8@pop.face2interface.com> In-Reply-To: <6.0.0.22.0.20040131195217.01b138d8@pop.face2interface.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200402011530.31203.dgw@liwest.at> Subject: Re: OT: sed problem X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Feb 2004 14:36:23 -0000 On Sunday 01 February 2004 00:58, Marty Landman wrote: > At 08:38 PM 1/31/2004, Daniela wrote: > >I was wondering how I can do the following with sed (or another program): > > How's Perl, Daniela? > > >1. Output only the text from the start of the line to the first pipe > > character > > $out = ($line =~ /^([^\|]+)/); > > >2. Output only the text between the last and the previous pipe character > > $out = ($line =~ /\|([^\|]+)|/); > > >Or, split the line at the pipe characters and assign the parts to > >different shell variables. > > my @ary = split '|', $line; Looks fine, but does Perl support multi-dimensional arrays? > These are untested but probably pretty close at least. Sorry, I haven't > gotten to shell scripting yet so I think in terms of Perl. > > Marty Landman Face 2 Interface Inc 845-679-9387 > This Month's New Quiz --- Past Superbowl Winners > Make a Website: http://face2interface.com/Home/Demo.shtml