From owner-freebsd-questions@FreeBSD.ORG Thu Oct 20 21:12:08 2005 Return-Path: X-Original-To: freebsd-questions@FreeBSD.org Delivered-To: freebsd-questions@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E728F16A41F; Thu, 20 Oct 2005 21:12:08 +0000 (GMT) (envelope-from jkim@FreeBSD.org) Received: from anuket.mj.niksun.com (gwnew.niksun.com [65.115.46.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6D9F543D5A; Thu, 20 Oct 2005 21:12:03 +0000 (GMT) (envelope-from jkim@FreeBSD.org) Received: from niksun.com (anuket [10.70.0.5]) by anuket.mj.niksun.com (8.13.1/8.13.1) with ESMTP id j9KLK3nR077179; Thu, 20 Oct 2005 17:20:03 -0400 (EDT) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: freebsd-stable@FreeBSD.org, f-q Date: Thu, 20 Oct 2005 17:11:44 -0400 User-Agent: KMail/1.6.2 References: <20051020194725.GA10376@ns.museum.rain.com> <20051020205704.GC4000@holestein.holy.cow> In-Reply-To: <20051020205704.GC4000@holestein.holy.cow> MIME-Version: 1.0 Content-Disposition: inline Content-Type: Multipart/Mixed; boundary="Boundary-00=_VgAWDoCKl2Bf8Kw" Message-Id: <200510201711.49382.jkim@FreeBSD.org> X-Virus-Scanned: ClamAV devel-20050919/1145/Thu Oct 20 08:01:39 2005 on anuket.mj.niksun.com X-Virus-Status: Clean Cc: James Long Subject: Re: bzegrep behaviour not consistent with egrep? 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: Thu, 20 Oct 2005 21:12:09 -0000 --Boundary-00=_VgAWDoCKl2Bf8Kw Content-Type: text/plain; charset="euc-kr" Content-Transfer-Encoding: 7bit Content-Disposition: inline On Thursday 20 October 2005 04:57 pm, Parv wrote: > in message <20051020194725.GA10376@ns.museum.rain.com>, > wrote James Long thusly... > > > Should these two commands produce identical output? > > > > $ bzegrep "38436|41640" /var/log/maillog.0.bz2 | wc -l > > 0 > > $ bzcat /var/log/maillog.0.bz2 | egrep "38436|41640" | wc -l > > 121 Can you try the patch for src/gnu/usr.bin/grep/grep.c? > And more fun, try also "egrep -J| wc", which is similar to the 2d > case above. Can you elaborate the fun, please? Thanks, JK > Seems like the first "e" in "bzegrep" is erroneous. > - Parv --Boundary-00=_VgAWDoCKl2Bf8Kw Content-Type: text/x-diff; charset="euc-kr"; name="grep.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="grep.diff" Index: grep.c =================================================================== RCS file: /home/ncvs/src/gnu/usr.bin/grep/grep.c,v retrieving revision 1.31 diff -u -r1.31 grep.c --- grep.c 14 May 2005 05:35:04 -0000 1.31 +++ grep.c 20 Oct 2005 20:55:05 -0000 @@ -1359,16 +1359,16 @@ if (program_name && strrchr (program_name, '/')) program_name = strrchr (program_name, '/') + 1; + if (strlen (program_name) > 1 && program_name[0] == 'b' && program_name[1] == 'z') { + BZflag = 1; + program_name += 2; + } #if HAVE_LIBZ > 0 - if (program_name[0] == 'z') { + else if (strlen (program_name) > 0 && program_name[0] == 'z') { Zflag = 1; ++program_name; } #endif - if (program_name[0] == 'b') { - BZflag = 1; - ++program_name; - } #if defined(__MSDOS__) || defined(_WIN32) /* DOS and MS-Windows use backslashes as directory separators, and usually --Boundary-00=_VgAWDoCKl2Bf8Kw--