From owner-freebsd-questions@FreeBSD.ORG Wed Jun 6 16:16:18 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 9157316A421 for ; Wed, 6 Jun 2007 16:16:18 +0000 (UTC) (envelope-from mnslinky@gmail.com) Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.177]) by mx1.freebsd.org (Postfix) with ESMTP id 6764B13C45E for ; Wed, 6 Jun 2007 16:16:18 +0000 (UTC) (envelope-from mnslinky@gmail.com) Received: by wa-out-1112.google.com with SMTP id j37so272876waf for ; Wed, 06 Jun 2007 09:16:18 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=Af6nDYM09LqT4p7i609Ct3N5v8w/gxYN7acrYmtgIm6YbNVlpwN5giElRHK3ebWjYe28aQh1HDkkbKZbXSeS85LYttoEbCVabv6job2e7B34dGSMGbkhIncFyEW7OHv8kJUSTU2U/ZKHRe3/u/4UtntuS9blC1xgFF2DmB13Owg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=R1lEmwxAEy4uSMDk5TCDG3jOmSXQoJ09pDPuQ3JN6YjlOfrN8kXXdY+41Ya2VhZtlIAQNxpof1A2/QBx7iN0bAynsOC4dPEnRa4wDlyOBiihQfsAQyvgKLdpTZ7Ny+xkNW8klJ5vrpfkP7R/u8MO3TgOLzoCrcUGpAYhB9qhFYc= Received: by 10.114.125.2 with SMTP id x2mr544611wac.1181146577849; Wed, 06 Jun 2007 09:16:17 -0700 (PDT) Received: by 10.114.204.1 with HTTP; Wed, 6 Jun 2007 09:16:17 -0700 (PDT) Message-ID: <905f1be0706060916u19f4c5coc8eb4b60521c8095@mail.gmail.com> Date: Wed, 6 Jun 2007 11:16:17 -0500 From: "Eric F Crist" To: "Zhang Weiwu" In-Reply-To: <1181141423.18606.91.camel@joe.realss.com> MIME-Version: 1.0 References: <1181141423.18606.91.camel@joe.realss.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 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:16:18 -0000 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 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" >