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

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

[debbugs-tracker] bug#24024: closed (grep: Mixing "max-count" and "after


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#24024: closed (grep: Mixing "max-count" and "after-context" outputs too few lines)
Date: Thu, 08 Sep 2016 05:26:02 +0000

Your message dated Wed, 7 Sep 2016 22:25:03 -0700
with message-id <address@hidden>
and subject line Re: bug#24024: grep: Mixing "max-count" and "after-context" 
outputs too few lines
has caused the debbugs.gnu.org bug report #24024,
regarding grep: Mixing "max-count" and "after-context" outputs too few lines
to be marked as done.

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


-- 
24024: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=24024
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: grep: Mixing "max-count" and "after-context" outputs too few lines Date: Tue, 19 Jul 2016 13:53:45 +0200
Hi,

Igor Bogomazov <address@hidden> filed the following bug against grep in
Debian.

El 18/07/16 a las 14:30, Igor Bogomazov escribió:
> Package: grep
> Version: 2.25-6
> Severity: normal
> 
> 
> Given after-context=3 it is expected to output at least 4 lines
> as documented, but adding max-count=1 makes it stop on the next
> matching line.
> 
> What I do:
> 
> $ printf '%s\n' a b a c | grep -m1 -A3 a
> 
> What I see:
> 
> a
> b
> 
> What I expect:
> 
> a
> b
> a
> c
> 
> -- System Information:
> Debian Release: stretch/sid
>   APT prefers unstable
>   APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable')
> Architecture: amd64 (x86_64)
> 
> Kernel: Linux 4.6.0-1-amd64 (SMP w/4 CPU cores)
> Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
> Shell: /bin/sh linked to /bin/dash
> Init: systemd (via /run/systemd/system)
> 
> Versions of packages grep depends on:
> ii  dpkg          1.18.9
> ii  install-info  6.1.0.dfsg.1-8
> ii  libc6         2.23-1
> ii  libpcre3      2:8.38-3.1
> 
> grep recommends no packages.
> 
> Versions of packages grep suggests:
> ii  libpcre3  2:8.38-3.1
> 
> -- no debconf information
> 

Note also the behavior when there is not a second match:

% printf '%s\n' a b d c | grep -m1 -A3 a
a
b
d
c

Cheers,

Santiago



--- End Message ---
--- Begin Message --- Subject: Re: bug#24024: grep: Mixing "max-count" and "after-context" outputs too few lines Date: Wed, 7 Sep 2016 22:25:03 -0700 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0
Given after-context=3 it is expected to output at least 4 lines
as documented, but adding max-count=1 makes it stop on the next
matching line.

Thanks for reporting this. Although grep's behavior is documented ("context does not include matching lines" in the node General Output Control) the documentation could be clearer and I installed the attached patch.

Attachment: 0001-doc-define-context-lines.txt
Description: Text document


--- End Message ---

reply via email to

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