GNU bug report logs -
#17799
grep 2.5.4 ignoring parts of expression
Previous Next
Reported by: Jim Michaels <jmichae3 <at> yahoo.com>
Date: Wed, 18 Jun 2014 11:57:01 UTC
Severity: normal
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 17799 in the body.
You can then email your comments to 17799 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-grep <at> gnu.org
:
bug#17799
; Package
grep
.
(Wed, 18 Jun 2014 11:57:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Jim Michaels <jmichae3 <at> yahoo.com>
:
New bug report received and forwarded. Copy sent to
bug-grep <at> gnu.org
.
(Wed, 18 Jun 2014 11:57:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
grep random "#include <(bits/)?random(\.h)?>" *
expected: on the include/c++/bits dir of a gcc compiler should produce a couple of results.
actual: produces pages and pages with just about every file in it. anything with the word random in it. grep is ignoring #include <(bits/)? and (\.h)?> and I have no clue why.
all I wanted was the header files in the compiler which #included anything related to random.h because I had a bug in gcc I was trying to report, so I ended up finding a bug in grep too.
-------------
Jim Michaels
Jmichae3 <at> yahoo.com
JimM <at> RenewalComputerServices.com
http://RenewalComputerServices.com
http://JesusnJim.com (my personal site, has software)
---
IEC Units: Computer RAM & SSD measurements, microsoft disk size measurements (note: they will say GB or MB or KB or TB when it is IEC Units!):
[KiB] [MiB] [GiB] [TiB]
[2^10B=1,024^1B=1KiB]
[2^20B=1,024^2B=1,048,576B=1MiB]
[2^30B=1,024^3B=1,073,741,824B=1GiB]
[2^40B=1,024^4B=1,099,511,627,776B=1TiB]
[2^50B=1,024^5B=1,125,899,906,842,624B=1PiB]
SI Units: Hard disk industry disk size measurements:
[kB] [MB] [GB] [TB]
[10^3B=1,000B=1kB]
[10^6B=1,000,000B=1MB]
[10^9B=1,000,000,000B=1GB]
[10^12B=1,000,000,000,000B=1TB]
[10^15B=1,000,000,000,000,000B=1PB]
[Message part 2 (text/html, inline)]
Reply sent
to
Paul Eggert <eggert <at> cs.ucla.edu>
:
You have taken responsibility.
(Wed, 18 Jun 2014 15:33:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Jim Michaels <jmichae3 <at> yahoo.com>
:
bug acknowledged by developer.
(Wed, 18 Jun 2014 15:33:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 17799-done <at> debbugs.gnu.org (full text, mbox):
Jim Michaels wrote:
> grep random "#include <(bits/)?random(\.h)?>" *
> expected: on the include/c++/bits dir of a gcc compiler should produce a couple of results.
>
> actual: produces pages and pages with just about every file in it. anything with the word random in it
That's because your command asked to find the word 'random'. It's of
the form:
grep random LIST-OF-FILE-NAMES
The first file name is "#include <(bits/)?random(\.h)?>", which grep
complained to you about.
Information forwarded
to
bug-grep <at> gnu.org
:
bug#17799
; Package
grep
.
(Wed, 18 Jun 2014 15:37:01 GMT)
Full text and
rfc822 format available.
Message #13 received at 17799 <at> debbugs.gnu.org (full text, mbox):
If you don't specify any options, grep regards a pattern as BRE.
http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap09.html#tag_09_03
(', `)' and `?' are treated as normal character in BRE. If you expect
that they are treated as special character, you must escape them with
backslash.
BTW, I see you want to use ERE.
http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap09.html#tag_09_04
If so, you must specify -E option. I test below on Fedora 20.
$ cd /usr/include/c++/4.8.2
$ grep -E "#include <(bits/)?random(\.h)?>" * 2>/dev/null
$ grep "#include <(bits/)?random(\.h)?>" * 2>/dev/null
random:#include <bits/random.h>
Information forwarded
to
bug-grep <at> gnu.org
:
bug#17799
; Package
grep
.
(Fri, 20 Jun 2014 07:24:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 17799 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi Jim,
Lets say i want to search for "#include <bits/c++config.h>" (on my machine,
i could not find any random.h under c++ directory) and this below grep
command works fine for me..
dev-RH: root - redhat[/usr/include/c++/4.1.1]
*# grep -r "#include <bits/c++config.h>" **
backward/alloc.h:#include <bits/c++config.h>
backward/function.h:#include <bits/c++config.h>
backward/heap.h:#include <bits/c++config.h>
backward/pair.h:#include <bits/c++config.h>
.....
.....
maybe, lets search random.h under all subdirectories(-r) and only one
output per file(-m 1) will ok, to avoid screen full of texts.
*grep -r -m 1 "random.h" * *
Let us know if still you are facing any issues.
Have a great day!
*Best Regards,*
*Sekar *
*The smallest things can have the biggest impact. Look inside. - Intel*
On Wed, Jun 18, 2014 at 10:32 AM, Paul Eggert <eggert <at> cs.ucla.edu> wrote:
> Jim Michaels wrote:
>
>> grep random "#include <(bits/)?random(\.h)?>" *
>> expected: on the include/c++/bits dir of a gcc compiler should produce a
>> couple of results.
>>
>> actual: produces pages and pages with just about every file in it.
>> anything with the word random in it
>>
>
> That's because your command asked to find the word 'random'. It's of the
> form:
>
> grep random LIST-OF-FILE-NAMES
>
> The first file name is "#include <(bits/)?random(\.h)?>", which grep
> complained to you about.
>
>
>
>
[Message part 2 (text/html, inline)]
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 18 Jul 2014 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 11 years and 30 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.