From owner-freebsd-questions@FreeBSD.ORG Sat Jan 31 16:59:07 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 0920D16A4CE for ; Sat, 31 Jan 2004 16:59:07 -0800 (PST) Received: from www6.web2010.com (www6.web2010.com [216.157.5.254]) by mx1.FreeBSD.org (Postfix) with ESMTP id E8D2C43D39 for ; Sat, 31 Jan 2004 16:59:05 -0800 (PST) (envelope-from MLandman@face2interface.com) Received: from delliver.face2interface.com (dialup-wash-129-203.thebiz.net [64.30.129.203] (may be forged)) by www6.web2010.com (8.12.10/8.9.0) with ESMTP id i110wCJt011634; Sat, 31 Jan 2004 19:58:29 -0500 (EST) Message-Id: <6.0.0.22.0.20040131195217.01b138d8@pop.face2interface.com> X-Sender: face@pop.face2interface.com X-Mailer: QUALCOMM Windows Eudora Version 6.0.0.22 Date: Sat, 31 Jan 2004 19:58:25 -0500 To: Daniela , questions@freebsd.org From: Marty Landman In-Reply-To: <200402010138.44102.dgw@liwest.at> References: <200402010138.44102.dgw@liwest.at> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed 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 00:59:07 -0000 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; 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