-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Stop on first non-match after positive match #1790
Copy link
Copy link
Closed
Labels
enhancementAn enhancement to the functionality of the software.An enhancement to the functionality of the software.help wantedOthers are encouraged to work on this issue.Others are encouraged to work on this issue.rollupA PR that has been merged with many others in a rollup.A PR that has been merged with many others in a rollup.
Metadata
Metadata
Assignees
Labels
enhancementAn enhancement to the functionality of the software.An enhancement to the functionality of the software.help wantedOthers are encouraged to work on this issue.Others are encouraged to work on this issue.rollupA PR that has been merged with many others in a rollup.A PR that has been merged with many others in a rollup.
Feature request summary
Stop search on first non-matching line, but only after having seen matching lines.
Motivation
On sorted or semi-sorted files, it is often useful to extract consecutive lines that match a given pattern. In some cases involving large files, time and IO can be saved by stopping the search after having matched such a run of consecutive lines.
I'm fairly convinced this feature can save countless CPU cycles and IO in big-ish data situations, particularly where timestamp matching is involved.
Example
Input:
Behaviour when searching for pattern
^2021-01-29T08with this option enabled:Pseudo code
Suggested documentation