@ -46,6 +47,7 @@ with open(cmd.filename,'r') if cmd.filename else sys.stdin as handle:
# Continue buffering if we've already started
if buffering:
buffered_lines+=1
output+=line
# If a line in the stanza matches, we output the stanza
@ -55,6 +57,9 @@ with open(cmd.filename,'r') if cmd.filename else sys.stdin as handle:
# Output/clear buffer when we encounter an end to the stanza
if re.search(end,line) and buffering==True:
# if we have the same start and end delimiters, assume there has to be one line differed. Alternatively we could check whether there are at least two on the line... but I'm lazy
if start == end and buffered_lines<=1:
continue
debug('Finished buffering on '+end)
if matched:
# Strip newlines if requrired
@ -62,10 +67,8 @@ with open(cmd.filename,'r') if cmd.filename else sys.stdin as handle: