Jeff King <peff@xxxxxxxx> writes: > On Wed, Oct 20, 2021 at 08:39:58PM +0200, Ævar Arnfjörð Bjarmason wrote: > >> get_synopsis () { >> + head -n 10 "Documentation/$1.txt" | >> sed -n ' >> /^NAME/,/'"$1"'/H >> ${ >> x >> s/.*'"$1"' - \(.*\)/N_("\1")/ >> p >> - }' "Documentation/$1.txt" >> + }' >> } > > By the way, I'm not sure about the utility of this change. It reduces > the number of lines that sed looks at, but at the cost of an extra > process. That's probably a net loss. And if we did want to limit the > data sed covers, doing "pq" after we matched would be simpler. Doesn't the above - slurp the lines into hold space while we are in the synopsis part; - otherwise keep reading and discarding; - and do the processing at end So presumably, instead of waiting till the end, can't we immediately process the thing and exit? I guess your "'pq' after we matched" is saying the same thing. I agree that extra process with an ad-hoc limitation of 10 does leave a bad taste in my mouth.