well, blew it... sed or perl q again.

Bertram Scharpf lists at bertram-scharpf.de
Wed Dec 31 04:36:53 UTC 2008


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


More information about the freebsd-questions mailing list