Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Dec 2008 05:36:47 +0100
From:      Bertram Scharpf <lists@bertram-scharpf.de>
To:        Gary Kline <kline@thought.org>, freebsd-questions@freebsd.org
Subject:   Re: well, blew it... sed or perl q again.
Message-ID:  <20081231043647.GB13851@marge.bs.l>
In-Reply-To: <20081231014802.GB46220@thought.org>
References:  <20081230193111.GA32641@thought.org> <20081230211633.GA24525@marge.bs.l> <20081231014802.GB46220@thought.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi Gary,

Am Dienstag, 30. Dez 2008, 17:48:02 -0800 schrieb Gary Kline:
> On Tue, Dec 30, 2008 at 10:16:33PM +0100, Bertram Scharpf wrote:
> > Hi Gary,
> > 
> > Am Dienstag, 30. Dez 2008, 11:31:14 -0800 schrieb Gary Kline:
> > > The problem is that there are many, _many_ embedded 
> > > "<A HREF="http://whatever>; Site</A> in my hundreds, or
> > > thousands, or files.  I only want to delete the
> > > "http://<junkfoo.com>" lines, _not_ the other Href links.
> > >
> > > sed or perl?
> > 
> > Ruby. Untested:
> > 
> >   $ ruby -i.bak -pe 'next if ~/href="([^"]*)"/i and $1 == "http://example.com"' somefile.html
> > 
> > Probably you want to do something more sophisticated.
> 
> 	no errors, but the new.htm is == new.htm.bak; in other words,
> 	it looks like a partial match on just "http" fails.  Don't
> 	know why.  i'm pretty sure the entire "<A HREF="http://foobar.com">; xxx </A>"
> 	would do it.  

This is not FreeBSD-specific, though.

I still wonder why you rely on lines just containing
%r{^<A.*>.*</A>$} . Maybe you're doing a quick'n'dirty solution
but I'm quite sure you won't get along with a one-liner.

Bertram


-- 
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de



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