Re: sed
On Fri, Sep 19, 2008 at 09:15:23AM +1000, Alex Samad wrote:
> On Thu, Sep 18, 2008 at 01:53:18PM +0000, Tzafrir Cohen wrote:
> > On Thu, Sep 18, 2008 at 02:29:29PM +0100, michael wrote:
> > > I've been struggling to get this to work but I think 'sed' should be
> > > able to do it if I could just get some help with the correct
> > > incantation...
> > >
> > >
> > > given a file with many strings, include many of the form
> > > <a href="some url or other">www</a>
> > >
> > > I wish each to be transformed to
> > > <a href="some url or other">some url or other</a>
> > >
> > > ie so literal 'www' is replaced with the actual URL for each
> > > occurance...
> >
> > Maybe:
> >
> > sed -e '\(<a href="\([^"]*\)">\)www\(</a>\)|\1\2\3|g'
>
> why is it that you don't need the s| at the beginning ?
Because of a typo, I guess.
sed -e 's|\(<a href="\([^"]*\)">\)www\(</a>\)|\1\2\3|g'
--
Tzafrir Cohen | tzafrir@jabber.org | VIM is
http://tzafrir.org.il | | a Mutt's
tzafrir@cohens.org.il | | best
ICQ# 16849754 | | friend
Reply to:
- References:
- sed
- From: michael <cs@networkingnewsletter.org.uk>
- Re: sed
- From: Tzafrir Cohen <tzafrir@cohens.org.il>
- Re: sed
- From: Alex Samad <alex@samad.com.au>