emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#31263: closed (If grep given both --context and --


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#31263: closed (If grep given both --context and --max-count, context not printed if it contains pattern)
Date: Thu, 26 Apr 2018 00:37:02 +0000

Your message dated Wed, 25 Apr 2018 17:36:04 -0700
with message-id <address@hidden>
and subject line Re: bug#31263: If grep given both --context and --max-count, 
context not printed if it contains pattern
has caused the debbugs.gnu.org bug report #31263,
regarding If grep given both --context and --max-count, context not printed if 
it contains pattern
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
31263: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=31263
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: If grep given both --context and --max-count, context not printed if it contains pattern Date: Wed, 25 Apr 2018 18:00:27 -0400 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

To the maintainers of GNU grep:

I came across a behavior I didn't expect when using grep with the flags --after-context and --max-count. If PATTERN is in the context, it won't be printed, presumably because I specified max count. Is this intended or a bug?

```sh

$ cat tmp.txt
hi
hello
test
hey there

$ grep -A 3 -m 1 h tmp.txt
hi

```

Expected behavior:
hi
hello
test

Thanks for your time,
Joshua Nelson
--
B.S. Computer Science
College of Engineering and Computing | South Carolina Honors College
(813) 404-5744 | address@hidden
GitHub | LinkedIn | website
This message was sent with a PGP signature.

Attachment: signature.asc
Description: OpenPGP digital signature


--- End Message ---
--- Begin Message --- Subject: Re: bug#31263: If grep given both --context and --max-count, context not printed if it contains pattern Date: Wed, 25 Apr 2018 17:36:04 -0700 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0
On 04/25/2018 03:00 PM, Joshua Nelson wrote:
$ cat tmp.txt > hi > hello > test > hey there > > $ grep -A 3 -m 1 h tmp.txt > hi >
> ``` > > Expected behavior: > hi > hello > test

Surely the output you expect should be:

hi
hello
test
hey there

because the "hey there" line is the third line of trailing context after the "hi" line. Anyway, the problem you're reporting was fixed in grep 3.1, so please try upgrading to the current version of grep.




--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]