Re: Using grep (or some other tool) to highlight, instead of grepping?

Ralf Wildenhues <[email protected]>
Newsgroups gmane.comp.gnu.utils
Organization Department of Numerical Simulation, University of Bonn
Message-ID <[email protected]>
Hello Richard,

* Richard Hartmann wrote on Tue, Aug 12, 2008 at 09:11:56PM CEST:
> 
>  grep --color=auto
> 
> I was wondering if there is a tool that will allow me to simply
> highlight whatever I am looking for without actually grepping.

I guess if you translate your basic regex into an extended one, then you
should be able to use egrep/grep -E, and also match end-of-line:
  grep -E --color=auto 'foo|$'

Hmm.  Using ^ instead of $ destroys the coloring, that looks like a bug
(Debian package grep-2.5.1.ds2-6).

Other than that, editors can typically highlight search matches:
  vim -c 'set hls | /foo' FILE

Hope that helps.

Cheers,
Ralf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.