Re: sed
On Thu, 2008-09-18 at 09:06 -0500, Matt Zagrabelny wrote:
> On Thu, 2008-09-18 at 14:29 +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...
>
> Well, it's not 'sed' (I prefer the PCRE), but this perl script ought to
> get you off the ground.
>
> #!/usr/bin/perl
>
> use strict;
>
> while (<>) {
> chomp;
> if (my ($url) = /<a href="([^"]*?)">www<\/a>/) {
> print "<a href=\"$url\">$url</a>\n";
> }
> }
it was easier to stick with sed (see other msgs for various solutions),
as it was part of much other file processing. but thanks! m
Reply to:
- References:
- sed
- From: michael <cs@networkingnewsletter.org.uk>
- Re: sed
- From: Matt Zagrabelny <mzagrabe@d.umn.edu>