From owner-freebsd-questions@FreeBSD.ORG Tue Aug 26 11:34:58 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 0905E1065695 for ; Tue, 26 Aug 2008 11:34:58 +0000 (UTC) (envelope-from anmichel@gmail.com) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.238]) by mx1.freebsd.org (Postfix) with ESMTP id DDCFD8FC1C for ; Tue, 26 Aug 2008 11:34:57 +0000 (UTC) (envelope-from anmichel@gmail.com) Received: by rv-out-0506.google.com with SMTP id b25so3181790rvf.43 for ; Tue, 26 Aug 2008 04:34:57 -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:to :subject:in-reply-to:mime-version:content-type:references; bh=pXEzyjBKchYtRcer5ceomJ7C1gAGf7c8r1iwiACqHE8=; b=mGHKxdCG1PdO9LxtGlAJgsHHKar7bVMDPCi9TGxwoHSMM1Mg7iLiyI2pYWX0oPRhMj fF9GX3//VyoJHOcywc5Zmxpf5gjxuuXmJ6UgIu6uw66rpkKg2T9RpRsMcGgvrU8efaXz 9OKK1i1kXQM414xBmVe2NqJTMWzdF5BluY1Pk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:references; b=tGQmTWRtS0O6DP8ja3P5kEQyLJM92ytrEwRxPPFeqPAjy2oQDYV1C452xEDHdXIyxP jHXL/yefj793Nt1TqkpiFa9kqrpwnR79Y7AIooWuEypgGhQ+7f+KQtxU+Jw23DJsxGu+ RgtuTO1KktmBq1eF2kfvEyjg+QtsDv2sYMdV0= Received: by 10.140.126.14 with SMTP id y14mr2782403rvc.59.1219750497285; Tue, 26 Aug 2008 04:34:57 -0700 (PDT) Received: by 10.141.123.18 with HTTP; Tue, 26 Aug 2008 04:34:57 -0700 (PDT) Message-ID: Date: Tue, 26 Aug 2008 07:34:57 -0400 From: An To: freebsd-questions@freebsd.org In-Reply-To: <48B39A4E.1@gmail.com> MIME-Version: 1.0 References: <41baaeae-0c1d-4a73-9540-8049b837261c@l64g2000hse.googlegroups.com> <48B356BE.3080501@datapipe.com> <48B39A4E.1@gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 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 11:34:58 -0000 Well, thanks, Yuri ! That worked much better than all that i had done ! But i have the problem that I don't know what characters to expect... accents, =F1, etc... So i really need a "get everything between the and the first "... Regarding perl, it is perfect ! thanks ! The ? is critical ! Is it what makes what makes the .* non greedy ? Thanks, An M On Tue, Aug 26, 2008 at 1:53 AM, Yuri Pankov wrote: > 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 =3D " 111 2222 3333 xxxx> > > 111 2222 3333 "; > > $text =3D~ s/]*>[^\(<\/span>\)]*[\s]*<\/span>[\s]*//g; > > print $text . "\n" > > $text =3D~ 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 < > pprocacci@datapipe.com>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 >