[bug #27196] Using -o and -i options together is broken

View: New views
6 Messages — Rating Filter:   Alert me  

[bug #27196] Using -o and -i options together is broken

by Eli Zaretskii-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


URL:
  <http://savannah.gnu.org/bugs/?27196>

                 Summary: Using -o and -i options together is broken
                 Project: grep
            Submitted by: None
            Submitted on: Thu 06 Aug 2009 11:52:00 PM UTC
                Category: None
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

Hi,

Using -i with -o produces unexpected results.

testfile contains:
Bonjour le monde.
Hello world.
Bonjour le monde.

But the command:
grep -o -i HELLO testfile
produces no output.

If I specify the pattern in all lowercase (grep -o -i hello testfile), I get
the expected result:
Hello

I would expect it to work the same regardless of the case of the pattern,
since -i means ignore case.  If -o is not specified, the case of the pattern
does not matter.

I have tested in both 2.5.4 and 2.6-cvs.




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?27196>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




[bug #27196] Using -o and -i options together is broken

by Eli Zaretskii-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Follow-up Comment #1, bug #27196 (project grep):

   Not reproduced. Please give us more information as LANG, LC_ALL, etc.


$ ./grep --version
GNU grep 2.5.4

Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ ./grep -o -i HELLO testfile
Hello
$ ./grep -o -i hello testfile
Hello


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?27196>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




Re: [bug #27196] Using -o and -i options together is broken

by Dave B-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Friday 07 August 2009 00:52:01 anonymous wrote:

> Hi,
>
> Using -i with -o produces unexpected results.
>
> testfile contains:
> Bonjour le monde.
> Hello world.
> Bonjour le monde.
>
> But the command:
> grep -o -i HELLO testfile
> produces no output.
>
> If I specify the pattern in all lowercase (grep -o -i hello testfile), I
> get the expected result:
> Hello

It works for me with GNU grep 2.5.3.

$ echo 'Bonjour le monde.
Hello world.
Bonjour le monde.' | grep -o -i HELLO
Hello

--
D.



Re: [bug #27196] Using -o and -i options together is broken

by Reuben Thomas :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It works for me with CVS grep.

--
http://rrt.sc3d.org
Psalms 19:12: tagline for the guilty



[bug #27196] Using -o and -i options together is broken

by Eli Zaretskii-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Follow-up Comment #2, bug #27196 (project grep):

$ echo abcDEF | ./grep -o -i C.E
cDE
$ echo abcDEF | LANG=en_US.ASCII ./grep -o -i C.E
$

Happens irregardless of --with/--without-included-regex

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?27196>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




Re: [bug #27196] Using -o and -i options together is broken

by Jim Meyering :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Paolo Bonzini wrote:
> Follow-up Comment #2, bug #27196 (project grep):
>
> $ echo abcDEF | ./grep -o -i C.E
> cDE
> $ echo abcDEF | LANG=en_US.ASCII ./grep -o -i C.E
> $
>
> Happens irregardless of --with/--without-included-regex

Hi Paolo,

Thanks for all the triage!

Note that the first didn't print anything for me,
since I have LC_ALL=C in my environment:

    $ echo abcDEF | LC_ALL=en_GB.UTF-8 ./grep -o -i C.E
    cDE
    $ echo abcDEF | LC_ALL=C ./grep -o -i C.E