Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Dec 2008 22:16:33 +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:  <20081230211633.GA24525@marge.bs.l>
In-Reply-To: <20081230193111.GA32641@thought.org>
References:  <20081230193111.GA32641@thought.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



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