Subject: bug#17687: enhancement request: contiguous lines

From: [email-masked]
Date: Wed, 4 Jun 2014 13:36:56 +0100 (BST)

Dear All,

Hope this mail finds you well and that its content raises some interest if it can help the grep users community.

Given that I use very often grep on large files, I realized how useful the option '-max-line' can be. Nevertheless, I found that the following enhancement could be of interest for faster processing and hence develop the use of grep:

enhancement concept: in addition to the current --max-count=num option which takes a numerical input, one could imagine another possibility (like --max-count="contiguous") which would only retrieve contiguous matching lines since the first match.

advantages: the current --max-count option improves the speed of the search with an early stop (after n matches) but it assumes the user knows exactly the number of lines to look into. With the "contiguous" option, the search provides all contiguous searches and then stops.

remark: this enhancement does not aim to compete with a "database" approach especially for time-serie management, but still many large files can have for example timestamps and using this option would accelerate the searches in sorted files thanks to the early stop.

Again, if my enhancement request is redundant with a former one already proposed or does not fit in the grep approach, please forgive me.

Have a nice day and thanks again for the great work.

Alain