Is there an option or command similar to grep's -m1 or awk's nextfile for sed, which would allow sed to immediately stop processing the current input file when a match is found (while continuing to process subsequent input files)?
For example:
find . -type f -exec sed -ns '/pattern/{<do stuff>; p; <next>}' {} +
where <next> would be a command to cease reading the current input file. The quit command (q) is not suitable, since it simply causes sed to exit (abandoning subsequent input files), and would therefore find at most one match per batch of input files.
\;instead of+so thatsedsees only one file input at a time?+for performance reasons.awkorperlas they do have ability to skip rest of the lines... if your input is ASCII, usingLC_ALL=Cwill give you speed boost.. perhaps usexargsto parallelize.. and do at least try\;withq.. it isn't always easy to know speed results without actually performing the testsLC_ALL=Cis a good point in terms of performance.