Subject: bug#17799: grep 2.5.4 ignoring parts of expression

From: Sekar Sundaram <[email-masked]>
Date: Thu, 19 Jun 2014 13:41:37 -0500

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 <[email-masked]> 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.
>
>
>
>