Date: Wed, 6 Jun 2007 11:16:17 -0500 From: "Eric F Crist" <mnslinky@gmail.com> To: "Zhang Weiwu" <zhangweiwu@realss.com> Cc: freebsd-questions@freebsd.org Subject: Re: share my experience: highlight parts of a text file that matches a regular expression Message-ID: <905f1be0706060916u19f4c5coc8eb4b60521c8095@mail.gmail.com> In-Reply-To: <1181141423.18606.91.camel@joe.realss.com> References: <1181141423.18606.91.camel@joe.realss.com>
next in thread | previous in thread | raw e-mail | index | archive | help
That's great! One question, how do I make it highlight the entire line, rather than the searched-for text? Thanks! Eric Crist On 6/6/07, Zhang Weiwu <zhangweiwu@realss.com> wrote: > > Dear list > > I'd like to highlight part of output of one application that matches a > regular expression. First I thought this is simple: > > $ my_app | grep --color=auto 'regexp' > > This method have a big problem that lines doesn't match regexp is not > displayed, in my case I want all output of my_app being displayed, only > the matching part highlighted. > > First I thought grep might have a parameter to output everything it > receive, and it seems it doesn't. And I discovered I can use '-e' > parameter for this purpose: > > $ my_app | grep --color=auto -e 'regexp' -e '$' > > The second -e makes all line matched. > > Maybe useful for some newbies. > -- > Zhang Weiwu > Real Softservice > http://www.realss.com > +86 592 2091112 > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to " > freebsd-questions-unsubscribe@freebsd.org" >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?905f1be0706060916u19f4c5coc8eb4b60521c8095>