public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Bug: grep does not work with [^...]
@ 2018-05-04 20:32 Dmitry Lanin
  2018-05-04 21:03 ` Michel LaBarre
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Lanin @ 2018-05-04 20:32 UTC (permalink / raw)
  To: cygwin

Bug: grep does not work with [^...]

Run the following command:
echo qwe | grep -E '[^r]'

Expected result:
qwe

Actual result:
-nothing-

-----------------------------------
cygwin DLL version: 2.10.0
base-cygwin          3.8-1
bash                 4.4.12-3
coreutils            8.26-2
cygutils             1.4.16-2
cygwin               2.10.0-1
grep                 3.0-2
-----------------------------------

Kind regards,
Dmitry


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: grep does not work with [^...]
  2018-05-04 20:32 Bug: grep does not work with [^...] Dmitry Lanin
@ 2018-05-04 21:03 ` Michel LaBarre
  2018-05-04 22:21   ` Dmitry Lanin
  0 siblings, 1 reply; 4+ messages in thread
From: Michel LaBarre @ 2018-05-04 21:03 UTC (permalink / raw)
  To: 'Dmitry Lanin', cygwin

Run it in bash instead.
^ is a quote character in CMD.

> -----Original Message-----
> From: cygwin-owner@cygwin.com [mailto:cygwin-owner@cygwin.com] On
> Behalf Of Dmitry Lanin
> Sent: May 4, 2018 4:32 PM
> To: cygwin@cygwin.com
> Subject: Bug: grep does not work with [^...]
> 
> Bug: grep does not work with [^...]
> 
> Run the following command:
> echo qwe | grep -E '[^r]'
> 
> Expected result:
> qwe
> 
> Actual result:
> -nothing-
> 
> -----------------------------------
> cygwin DLL version: 2.10.0
> base-cygwin          3.8-1
> bash                 4.4.12-3
> coreutils            8.26-2
> cygutils             1.4.16-2
> cygwin               2.10.0-1
> grep                 3.0-2
> -----------------------------------
> 
> Kind regards,
> Dmitry
> 
> 
> --
> Problem reports:       http://cygwin.com/problems.html
> FAQ:                   http://cygwin.com/faq/
> Documentation:         http://cygwin.com/docs.html
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: grep does not work with [^...]
  2018-05-04 21:03 ` Michel LaBarre
@ 2018-05-04 22:21   ` Dmitry Lanin
  2018-05-05  3:52     ` Brian Inglis
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Lanin @ 2018-05-04 22:21 UTC (permalink / raw)
  To: Michel LaBarre; +Cc: cygwin

Hello Michel,

Thank you.
Yes, I guessed it is a special character, so I tried (did not work):
echo qwe | grep -E '[\^r]'

I have finally figured out. Using double-quotes work:
echo qwe | grep -E "[^r]"

Kind regards,
Dmitry

Friday, May 4, 2018, 5:03:32 PM, you wrote:

ML> Run it in bash instead.
ML> ^ is a quote character in CMD.

>> -----Original Message-----
>> From: cygwin-owner@cygwin.com [mailto:cygwin-owner@cygwin.com] On
>> Behalf Of Dmitry Lanin
>> Sent: May 4, 2018 4:32 PM
>> To: cygwin@cygwin.com
>> Subject: Bug: grep does not work with [^...]
>> 
>> Bug: grep does not work with [^...]
>> 
>> Run the following command:
>> echo qwe | grep -E '[^r]'
>> 
>> Expected result:
>> qwe
>> 
>> Actual result:
>> -nothing-
>> 
>> -----------------------------------
>> cygwin DLL version: 2.10.0
>> base-cygwin          3.8-1
>> bash                 4.4.12-3
>> coreutils            8.26-2
>> cygutils             1.4.16-2
>> cygwin               2.10.0-1
>> grep                 3.0-2
>> -----------------------------------
>> 
>> Kind regards,
>> Dmitry
>> 
>> 
>> --
>> Problem reports:       http://cygwin.com/problems.html
>> FAQ:                   http://cygwin.com/faq/
>> Documentation:         http://cygwin.com/docs.html
>> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple




-- 
Best regards,
 Dmitry                            mailto:jjj17@yandex.ru


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: grep does not work with [^...]
  2018-05-04 22:21   ` Dmitry Lanin
@ 2018-05-05  3:52     ` Brian Inglis
  0 siblings, 0 replies; 4+ messages in thread
From: Brian Inglis @ 2018-05-05  3:52 UTC (permalink / raw)
  To: cygwin

On 2018-05-04 16:20, Dmitry Lanin wrote:
> Friday, May 4, 2018, 5:03:32 PM, Michel LaBarre wrote:
>>> On May 4, 2018 4:32 PM Dmitry Lanin wrote:
>>> Bug: grep does not work with [^...]
>>> Run the following command:
>>> echo qwe | grep -E '[^r]'
>>> Expected result:
>>> qwe
>>> Actual result:
>>> -nothing-
>> Run it in bash instead.
>> ^ is a quote character in CMD.
> Yes, I guessed it is a special character, so I tried (did not work):
> echo qwe | grep -E '[\^r]'
> I have finally figured out. Using double-quotes work:
> echo qwe | grep -E "[^r]"

Safer to double it under cmd:
	> echo ^^
	^

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-05-05  3:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-04 20:32 Bug: grep does not work with [^...] Dmitry Lanin
2018-05-04 21:03 ` Michel LaBarre
2018-05-04 22:21   ` Dmitry Lanin
2018-05-05  3:52     ` Brian Inglis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).