GNU bug report logs - #24067
Bug Report : How to grep and treat meta character as normal character?

Previous Next

Package: grep;

Reported by: bibek ghimire <gbibek <at> gmail.com>

Date: Mon, 25 Jul 2016 17:33: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 24067 in the body.
You can then email your comments to 24067 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#24067; Package grep. (Mon, 25 Jul 2016 17:33:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to bibek ghimire <gbibek <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-grep <at> gnu.org. (Mon, 25 Jul 2016 17:33:01 GMT) Full text and rfc822 format available.

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

From: bibek ghimire <gbibek <at> gmail.com>
To: bug-grep <at> gnu.org
Subject: Bug Report : How to grep and treat meta character as normal character?
Date: Mon, 25 Jul 2016 00:21:54 -0500
[Message part 1 (text/plain, inline)]
Hi there,
            i have asked this
<http://unix.stackexchange.com/questions/297868/how-to-grep-and-treat-meta-character-as-normal-character>
question in stackoverflow was not able to find out why

 I get error :

 grep: \<int: No such file or directory
     grep: N\>: No such file or directory

When I use $grep -F ...

        problem happen but

       when I use fgrep the problem vanishes.


-Solta
[Message part 2 (text/html, inline)]

Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Tue, 26 Jul 2016 07:16:02 GMT) Full text and rfc822 format available.

Notification sent to bibek ghimire <gbibek <at> gmail.com>:
bug acknowledged by developer. (Tue, 26 Jul 2016 07:16:02 GMT) Full text and rfc822 format available.

Message #10 received at 24067-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: bibek ghimire <gbibek <at> gmail.com>, 24067-done <at> debbugs.gnu.org
Subject: Re: bug#24067: Bug Report : How to grep and treat meta character as
 normal character?
Date: Tue, 26 Jul 2016 09:15:47 +0200
It appears that you have an alias or other implementation of 'grep', and 
that this is not a bug in GNU 'grep' per se. If you are using a shell 
like 'bash', try these two shell commands to see which 'grep' you are 
actually using.

type grep
which grep





Information forwarded to bug-grep <at> gnu.org:
bug#24067; Package grep. (Tue, 26 Jul 2016 14:48:02 GMT) Full text and rfc822 format available.

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

From: bibek ghimire <gbibek <at> gmail.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 24067-done <at> debbugs.gnu.org
Subject: Re: bug#24067: Bug Report : How to grep and treat meta character as
 normal character?
Date: Tue, 26 Jul 2016 09:46:57 -0500
[Message part 1 (text/plain, inline)]
Hi Paul,
         When I use type grep I get following :

$ type grep

grep is a function

grep ()

{

    /usr/bin/grep --color=auto $*

}

          When I use which grep I get following:

$which grep

/usr/bin/grep



-Solti



On Tue, Jul 26, 2016 at 2:15 AM, Paul Eggert <eggert <at> cs.ucla.edu> wrote:

> It appears that you have an alias or other implementation of 'grep', and
> that this is not a bug in GNU 'grep' per se. If you are using a shell like
> 'bash', try these two shell commands to see which 'grep' you are actually
> using.
>
> type grep
> which grep
>
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-grep <at> gnu.org:
bug#24067; Package grep. (Tue, 26 Jul 2016 15:08:02 GMT) Full text and rfc822 format available.

Message #16 received at 24067-done <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: bibek ghimire <gbibek <at> gmail.com>
Cc: Paul Eggert <eggert <at> cs.ucla.edu>, 24067-done <at> debbugs.gnu.org
Subject: Re: bug#24067: Bug Report : How to grep and treat meta character as
 normal character?
Date: Tue, 26 Jul 2016 08:07:09 -0700
On Tue, Jul 26, 2016 at 7:46 AM, bibek ghimire <gbibek <at> gmail.com> wrote:
>     /usr/bin/grep --color=auto $*

That function is erroneous due to the use of unquoted $*.
Use this instead, which fixes that, and also works when the executable
grep is not in /usr/bin:

grep() { env grep --color=auto "$@"; }




Information forwarded to bug-grep <at> gnu.org:
bug#24067; Package grep. (Tue, 26 Jul 2016 15:27:01 GMT) Full text and rfc822 format available.

Message #19 received at 24067-done <at> debbugs.gnu.org (full text, mbox):

From: bibek ghimire <gbibek <at> gmail.com>
To: Jim Meyering <jim <at> meyering.net>
Cc: Paul Eggert <eggert <at> cs.ucla.edu>, 24067-done <at> debbugs.gnu.org
Subject: Re: bug#24067: Bug Report : How to grep and treat meta character as
 normal character?
Date: Tue, 26 Jul 2016 10:25:29 -0500
[Message part 1 (text/plain, inline)]
Hi Jim,
         After following your comment, the error (I am not sure now if I
could call it an error) has gone. So you were right, it was due to the way
I was handling positional parameters in my .profile file.

Sol: changing from

grep ()

{

    /usr/bin/grep --color=auto $*

}


to

grep ()

{

    /usr/bin/grep --color=auto "$@"

}
solved it. (Not sure ';' is required here )

-Bibek

On Tue, Jul 26, 2016 at 10:07 AM, Jim Meyering <jim <at> meyering.net> wrote:

> On Tue, Jul 26, 2016 at 7:46 AM, bibek ghimire <gbibek <at> gmail.com> wrote:
> >     /usr/bin/grep --color=auto $*
>
> That function is erroneous due to the use of unquoted $*.
> Use this instead, which fixes that, and also works when the executable
> grep is not in /usr/bin:
>
> grep() { env grep --color=auto "$@"; }
>
[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. (Wed, 24 Aug 2016 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 294 days ago.

Previous Next


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