From owner-freebsd-questions@FreeBSD.ORG Thu Aug 28 21:29:18 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5609D1065679 for ; Thu, 28 Aug 2008 21:29:18 +0000 (UTC) (envelope-from joji@eskimo.com) Received: from ultra6.eskimo.com (ultra6.eskimo.com [204.122.16.69]) by mx1.freebsd.org (Postfix) with ESMTP id 130998FC14 for ; Thu, 28 Aug 2008 21:29:18 +0000 (UTC) (envelope-from joji@eskimo.com) Received: from eskimo.com (eskimo.com [204.122.16.13]) by ultra6.eskimo.com (8.14.2/8.14.0) with ESMTP id m7SLTH64012082; Thu, 28 Aug 2008 14:29:17 -0700 Received: (from joji@localhost) by eskimo.com (8.9.1a/8.9.1) id OAA16828; Thu, 28 Aug 2008 14:29:17 -0700 (PDT) Date: Thu, 28 Aug 2008 14:29:17 -0700 From: Joseph Olatt To: An Message-ID: <20080828142917.A16543@eskimo.com> References: <41baaeae-0c1d-4a73-9540-8049b837261c@l64g2000hse.googlegroups.com> <48B356BE.3080501@datapipe.com> <48B39A4E.1@gmail.com> <20080828094956.A1175@eskimo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: ; from anmichel@gmail.com on Thu, Aug 28, 2008 at 03:04:22PM -0400 Cc: freebsd-questions@freebsd.org Subject: Re: sed html tags X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Aug 2008 21:29:18 -0000 On Thu, Aug 28, 2008 at 03:04:22PM -0400, An wrote: > yes, it does work perfectly with the example I gave... the actual file > is some like > > ... 111 1111no 2222 > 3333 5555 6666 ... > > > your command only returns ]# sed 's/\( .*>.*<\/span>\)\(.*\)\(.*<\/span>\)/\2/' file > > 5555 > > > I wish to rip all .* and obtain If you wish to rip out all " .* " then the output would be: 2222 5555 If that is what you want, then try the following: sed 's/[ 0-9a-z<>]*<\/span>//g; s/<\/span>//g' But if Perl is already doing the job for you, I think this can be put to rest. regards, joseph > ... 2222 3333 5555 6666 ... > > > i think sed should be able to do it, but the operator [ ^ ( ) ]* is > not behaving as i think it would... perl does it alright, though : s