GNU bug report logs - #35077
grep bug?

Previous Next

Package: grep;

Reported by: Todd Hoatson <todd.hoatson <at> gmail.com>

Date: Tue, 2 Apr 2019 03:55:02 UTC

Severity: normal

Tags: notabug

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 35077 in the body.
You can then email your comments to 35077 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-grep <at> gnu.org:
bug#35077; Package grep. (Tue, 02 Apr 2019 03:55:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Todd Hoatson <todd.hoatson <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-grep <at> gnu.org. (Tue, 02 Apr 2019 03:55:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Todd Hoatson <todd.hoatson <at> gmail.com>
To: bug-grep <at> gnu.org
Subject: grep bug?
Date: Mon, 1 Apr 2019 20:47:14 -0500
[Message part 1 (text/plain, inline)]
I tried GNU grep 2.0d, using this: *\n[^#(/]*class*

This is intended to ensure that the word class is not preceded on the line
with #, ( or /.

This gave me 15 matches like:

*UpdateStatusForm.cs:62: /// A public method to get a singleton instance of
this class and display it.*

*UserViewSettingManager.cs:70: #region UserViewSettings class*

*VListControl.cs:462: message = uiFontRegex.Replace(message, "$1");*


Why do I still get lines with (, # and / ?  Is this a bug or am I doing
something wrong?

thanks,
Todd Hoatson
[Message part 2 (text/html, inline)]

Information forwarded to bug-grep <at> gnu.org:
bug#35077; Package grep. (Tue, 02 Apr 2019 08:50:03 GMT) Full text and rfc822 format available.

Message #8 received at 35077 <at> debbugs.gnu.org (full text, mbox):

From: Shlomi Fish <shlomif <at> shlomifish.org>
To: Todd Hoatson <todd.hoatson <at> gmail.com>
Cc: 35077 <at> debbugs.gnu.org
Subject: Re: bug#35077: grep bug?
Date: Tue, 2 Apr 2019 11:49:13 +0300
Hi Todd,

On Mon, 1 Apr 2019 20:47:14 -0500
Todd Hoatson <todd.hoatson <at> gmail.com> wrote:

> I tried GNU grep 2.0d, using this: *\n[^#(/]*class*
> 
> This is intended to ensure that the word class is not preceded on the line
> with #, ( or /.
> 

grep 2.0 is ancient - from 1996 - see https://ftp.gnu.org/gnu/grep/ - you
should upgrade. Otherwise, I think you need ^ / caret for start of line -
https://stackoverflow.com/questions/16944357/carets-in-regular-expressions .

> This gave me 15 matches like:
> 
> *UpdateStatusForm.cs:62: /// A public method to get a singleton instance of
> this class and display it.*
> 
> *UserViewSettingManager.cs:70: #region UserViewSettings class*
> 
> *VListControl.cs:462: message = uiFontRegex.Replace(message, "$1");*
> 
> 
> Why do I still get lines with (, # and / ?  Is this a bug or am I doing
> something wrong?
> 
> thanks,
> Todd Hoatson



-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
http://www.shlomifish.org/humour/bits/New-versions-of-the-GPL/

HP/UX is not a UNIX, and AIX is even less of it than that.
    — An Israeli Open Source Software Enthusiast.

Please reply to list if it's a mailing list post - http://shlom.in/reply .




Information forwarded to bug-grep <at> gnu.org:
bug#35077; Package grep. (Mon, 06 May 2019 02:07:01 GMT) Full text and rfc822 format available.

Message #11 received at 35077 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Todd Hoatson <todd.hoatson <at> gmail.com>
Cc: 35077 <at> debbugs.gnu.org
Subject: Re: bug#35077: grep bug?
Date: Sun, 5 May 2019 16:06:18 -1000
tags 35077 notabug
close 35077
stop

On Tue, Apr 2, 2019 at 4:42 PM Todd Hoatson <todd.hoatson <at> gmail.com> wrote:
> I tried GNU grep 2.0d, using this: *\n[^#(/]*class*
>
> This is intended to ensure that the word class is not preceded on the line
> with #, ( or /.
>
> This gave me 15 matches like:
>
> *UpdateStatusForm.cs:62: /// A public method to get a singleton instance of
> this class and display it.*
> *UserViewSettingManager.cs:70: #region UserViewSettings class*
> *VListControl.cs:462: message = uiFontRegex.Replace(message, "$1");*
>
> Why do I still get lines with (, # and / ?  Is this a bug or am I doing
> something wrong?

Use this instead:

  grep -E '^[^#(/]*\bclass\b' ...

"^" is the beginning-of-line anchor
The two '\b's ensure that class is not part of some other word like
unclassified or classy.
Also, grep-2.0d is very old. You really should get a more recent
version. Latest is grep-3.3.




Added tag(s) notabug. Request was from Paul Eggert <eggert <at> cs.ucla.edu> to control <at> debbugs.gnu.org. (Thu, 02 Jan 2020 09:27:01 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 35077 <at> debbugs.gnu.org and Todd Hoatson <todd.hoatson <at> gmail.com> Request was from Paul Eggert <eggert <at> cs.ucla.edu> to control <at> debbugs.gnu.org. (Thu, 02 Jan 2020 09:27:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 30 Jan 2020 12:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 88 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.