bug-grep
[Top][All Lists]
Advanced

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

bug#28682: Possible bug in conflict between -m and -A


From: Jesse Eedrah
Subject: bug#28682: Possible bug in conflict between -m and -A
Date: Thu, 5 Oct 2017 18:06:23 -0500

Oh my, that's embarrasing. I seem to have copy-pasted badly - what I get
when I make my testing overly complicated. Here's a simpler testing suite:

I would think that by asking for 2 matching lines and 3 lines of trailing
context, I would get 3 lines no matter what, even if there was another
coincidental match?

#! /bin/bash

test=$'1 search
2 search
3 search
4 context
5 context
6 context'
wanted=$'1 search
2 search
3 search
4 context
5 context'
received=$'1 search
2 search'

[[ $( echo "$test" | grep -m 2 -A 3 search ) == $wanted ]] && echo Pass ||
echo Fail
[[ $( echo "$test" | grep -m 2 -A 3 search ) == $received ]] && echo Should
not happen but it does

# I'm using:
# grep (GNU grep) 2.27


reply via email to

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