From owner-freebsd-questions@FreeBSD.ORG Wed Jun 6 16:37:13 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5D6A516A400 for ; Wed, 6 Jun 2007 16:37:13 +0000 (UTC) (envelope-from zhangweiwu@realss.com) Received: from bossdog.realss.com (bossdog.realss.com [211.157.108.128]) by mx1.freebsd.org (Postfix) with ESMTP id D937513C4C7 for ; Wed, 6 Jun 2007 16:37:12 +0000 (UTC) (envelope-from zhangweiwu@realss.com) Received: from localhost (unknown [127.0.0.1]) by bossdog.realss.com (Postfix) with ESMTP id C348D1C0008; Thu, 7 Jun 2007 00:37:12 +0800 (CST) Received: from bossdog.realss.com ([127.0.0.1]) by localhost (bossdog.realss.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 03410-09; Thu, 7 Jun 2007 00:37:10 +0800 (CST) Received: from eula (254.54.72.124.board.xm.fj.dynamic.163data.com.cn [124.72.54.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by bossdog.realss.com (Postfix) with ESMTP id 7E3D41C0007; Thu, 7 Jun 2007 00:37:10 +0800 (CST) Date: Thu, 7 Jun 2007 00:36:40 +0800 From: Zhang Weiwu To: "Eric F Crist" Message-ID: <20070607003640.28881437@eula> In-Reply-To: <905f1be0706060916u19f4c5coc8eb4b60521c8095@mail.gmail.com> References: <1181141423.18606.91.camel@joe.realss.com> <905f1be0706060916u19f4c5coc8eb4b60521c8095@mail.gmail.com> Organization: Real Softservice X-Mailer: Sylpheed-Claws 2.6.0 (GTK+ 2.10.11; i486-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: amavisd-new at bossdog.realss.com Cc: freebsd-questions@freebsd.org Subject: Re: share my experience: highlight parts of a text file that matches a regular expression X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jun 2007 16:37:13 -0000 =E4=BA=8E Wed, 6 Jun 2007 11:16:17 -0500 "Eric F Crist" =E5=86=99=E9=81=93: > That's great! One question, how do I make it highlight the entire > line, rather than the searched-for text? Guess would be: $ my_app | grep --color=3Dauto -e '.*regexp.*' -e '$' Add '.*' before and after your regular expression >=20 > Thanks! >=20 > Eric Crist >=20 >=20 > On 6/6/07, Zhang Weiwu 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=3Dauto '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=3Dauto -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" > > > _______________________________________________ > 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"