GNU bug report logs - #17799
grep 2.5.4 ignoring parts of expression

Previous Next

Package: grep;

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.

Full log


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

From: Norihiro Tanaka <noritnk <at> kcn.ne.jp>
To: Jim Michaels <jmichae3 <at> yahoo.com>
Cc: 17799 <at> debbugs.gnu.org
Subject: Re: bug#17799: grep 2.5.4 ignoring parts of expression
Date: Thu, 19 Jun 2014 00:36:41 +0900
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>





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.