bug-grep
[Top][All Lists]
Advanced

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

bug#24024: grep: Mixing "max-count" and "after-context" outputs too few


From: Santiago Ruano Rincón
Subject: bug#24024: 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





reply via email to

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