[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sed html tags
- To: "Joseph Olatt" <joji_(_at_)_eskimo_(_dot_)_com>, freebsd-questions_(_at_)_freebsd_(_dot_)_org
- Subject: Re: sed html tags
- From: An <anmichel_(_at_)_gmail_(_dot_)_com>
- Date: Thu, 28 Aug 2008 15:04:22 -0400
- Cc:
- 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 :content-transfer-encoding:content-disposition:references; bh=nfGI8TY4wYobRcSo9GX1kjSZ0eVip3uvlwL1DCnWr5Q=; b=oqQmGC8eafqKQu3evDqXN4zSlnOpYoPO9NlJGFjcHNBccCR14e1MrHBtvpq/ay9Pue 9Az/bBVtBOzKXl/I1+g9bJa5KJJjgjeX+hzr2C5ugTHDXOkBNYZdg005rjB7qgIGMMPz 5dAqgARBtJbEjX5wFv91aekA3fis8vaEJUm1w=
yes, it does work perfectly with the example I gave... the actual file
is some like
... <span xxxx> 111 <span www> 1111no </span> </span> 2222 <span yyy>
3333 </span> 5555 <span yyy> 6666 </span> ...
your command only returns ]# sed 's/\(<span
.*>.*<\/span>\)\(.*\)\(<span .*>.*<\/span>\)/\2/' file
5555
I wish to rip all <span xxx> .* </span> and obtain
... 2222 <span yyy> 3333 </span> 5555 <span yyy> 6666 </span>...
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
thanks,
siran
On Thu, Aug 28, 2008 at 12:49 PM, Joseph Olatt <joji_(_at_)_eskimo_(_dot_)_com> wrote:
> <snip>
>
>> > >>> Hi, I have the string
>> > >>>
>> > >>> <span xxxx> 111 </span> 2222 <span yyyy> 3333 </span>
>> > >>>
>> > >>> And i wish to use sed to strip *only* the "<span xxxx>" tag and its
>> > >>> contents... is this possible ? I'm trying this expression, but it
>> > >>> doesn't work...
>> > >>>
>> > >>> sed 's/<span xxxx[^\(</span>\)]+<\/span>//g' file
>> > >>>
>> > >>> is there anything like it ?
>> > >>>
>> > >>> I would like to obtain
>> > >>>
>> > >>> 2222
>> > >>>
>> > >>>
>> > >>>
>> > >>> I hope someone can help,
>> > >>>
>> > >>> thank you,
>> > >>>
>> > >>> siran
>
> If you haven't yet solved the above problem, give the following a try:
>
> sed 's/\(<span .*>.*<\/span>\)\(.*\)\(<span .*>.*<\/span>\)/\2/'
>
>
> regards,
> joseph
>
> <snip>
>
_______________________________________________
freebsd-questions_(_at_)_freebsd_(_dot_)_org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe_(_at_)_freebsd_(_dot_)_org"
Visit your host, monkey.org