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

Bertram Scharpf lists at bertram-scharpf.de
Tue Dec 30 21:16:36 UTC 2008


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.

Bertram


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


More information about the freebsd-questions mailing list