From owner-freebsd-questions@FreeBSD.ORG Tue Aug 26 06:20:05 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 C19E31065678 for ; Tue, 26 Aug 2008 06:20:05 +0000 (UTC) (envelope-from yuri.pankov@gmail.com) Received: from ey-out-2122.google.com (ey-out-2122.google.com [74.125.78.26]) by mx1.freebsd.org (Postfix) with ESMTP id 48EC98FC17 for ; Tue, 26 Aug 2008 06:20:05 +0000 (UTC) (envelope-from yuri.pankov@gmail.com) Received: by ey-out-2122.google.com with SMTP id 6so208725eyi.7 for ; Mon, 25 Aug 2008 23:20:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=6vGdVzPZfEzxUmdQIf1zEDpK80AMRX0LFR91uTc5bfY=; b=D3rp/h+jzTxOE3zZdhop9DP/GEjeDD5phb4tQw6BEn7ZIz3ZFESOq+XvG0ARzsv3Um tcML8R11yk+psfvRUEWkWpeo+AyE11Mtx/l3z3EKgUQ2HSob2BuiqIwHns5da/bPDE/t STExE8e1QOrUFceHZGsKeGIu29lF5k1C5u5Ds= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=Rnpj+HJbgx1LzqVrZTsykS9hz7GPULzPilHATKQFqVUPPkaLflBzetIUKX+xtHZLE7 ziFKZiH7p19ClqvJ1CaIncvN38ojSY13qermrl0ayBBdyG8uWgUNpbqfJMs7udtuRZho kFy+6uq95dFuGMxcoCWhQFJCtQ1Rw3tbEcFG0= Received: by 10.210.34.5 with SMTP id h5mr7845471ebh.84.1219730040780; Mon, 25 Aug 2008 22:54:00 -0700 (PDT) Received: from ?192.168.1.2? ( [85.173.18.252]) by mx.google.com with ESMTPS id j8sm23789580gvb.1.2008.08.25.22.53.58 (version=SSLv3 cipher=RC4-MD5); Mon, 25 Aug 2008 22:53:59 -0700 (PDT) Message-ID: <48B39A4E.1@gmail.com> Date: Tue, 26 Aug 2008 09:53:18 +0400 From: Yuri Pankov User-Agent: Thunderbird 3.0a1 (Windows/2008050715) MIME-Version: 1.0 To: An References: <41baaeae-0c1d-4a73-9540-8049b837261c@l64g2000hse.googlegroups.com> <48B356BE.3080501@datapipe.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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: Tue, 26 Aug 2008 06:20:05 -0000 An wrote: > unfortunately not... see: > > # cat file > 111 2222 3333 > > # sed -e 's/<\/?span[^>]*>//g' file > 111 2222 3333 > > (...nothing happens, the file is returned with no substitutions done) > > > I could do it with a perl script, which basically does what i would expect > sed would do: > > # cat pscript.pl > #!/usr/bin/perl -w > $text = " 111 2222 3333 > 111 2222 3333 "; > $text =~ s/]*>[^\(<\/span>\)]*[\s]*<\/span>[\s]*//g; > print $text . "\n" $text =~ s#.*?\s*##g; > # perl pscript.pl > 2222 3333 2222 3333 > > " ..... " is removed... but i don't seem to be able to do > it with sed... : ( regexps in sed are greedy and, sadly, you can't use *? as quantifier. try the following (adding characters that can be inside your 'xxxx' tags, of course): sed 's#[ a-zA-Z0-9]*[ ]*##g' > Im on fedora c9, maybe that's the problem ? > > siran > > > On Mon, Aug 25, 2008 at 8:35 PM, Paul A. Procacci wrote: > >> siran wrote: >> >>> Hi, I have the string >>> >>> 111 2222 3333 >>> >>> And i wish to use sed to strip *only* the "" tag and its >>> contents... is this possible ? I'm trying this expression, but it >>> doesn't work... >>> >>> sed 's/\)]+<\/span>//g' file >>> >>> is there anything like it ? >>> >>> I would like to obtain >>> >>> 2222 >>> >>> >>> >>> I hope someone can help, >>> >>> thank you, >>> >>> siran >>> _______________________________________________ >>> freebsd-questions@freebsd.org mailing list >>> http://lists.freebsd.org/mailman/listinfo/freebsd-questions >>> To unsubscribe, send any mail to " >>> freebsd-questions-unsubscribe@freebsd.org" >>> >>> >> sed -E 's/<\/?span[^>]*>//g' >> >> Myabe that's what you want? >> HTH, Yuri