Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Aug 2008 14:29:17 -0700
From:      Joseph Olatt <joji@eskimo.com>
To:        An <anmichel@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: sed html tags
Message-ID:  <20080828142917.A16543@eskimo.com>
In-Reply-To: <db2611860808281204ve41eb7dj3ec3d2c6b516dea2@mail.gmail.com>; from anmichel@gmail.com on Thu, Aug 28, 2008 at 03:04:22PM -0400
References:  <41baaeae-0c1d-4a73-9540-8049b837261c@l64g2000hse.googlegroups.com> <48B356BE.3080501@datapipe.com> <db2611860808252119g25adf379wf7b5825bbd4cd694@mail.gmail.com> <48B39A4E.1@gmail.com> <db2611860808260434l2a3fe744y5e94c46d581bc25a@mail.gmail.com> <20080828094956.A1175@eskimo.com> <db2611860808281204ve41eb7dj3ec3d2c6b516dea2@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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
> 
> ... <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


If you wish to rip out all "<span xxx> .* </span>" then the output would
be:

  2222   5555


If that is what you want, then try the following:

sed 's/<span [a-z]*>[ 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 <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


<snip>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080828142917.A16543>