Re: [PATCH v2 09/22] t/t4*: avoid redundant uses of cat
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 16, 2024, 06:04 UTC
- Message-ID
- <xmqqy1ain255.fsf@gitster.g>
- In-Reply-To
- <ZfT3H7IiewuhAA7M@nand.local>
Taylor Blau <me@ttaylorr.com> writes:
Show 8 quoted lines
> This and the two similar transformations below it look good to me. This > obviously isn't the fault of your patch (nor should it necessarily be > its aim to fix), but I wonder if it would be worthwhile to extract the > > tr "\0" "\n" <out | head -n 3 | grep 3.bar | cut -f 2 -d " " > > pattern into a helper function, since it's used in a few places in this > test script.
I somehow thought that the theme of the topic is to reduce the depth of the pipeline. "head -n 3" piped into "grep" sounds something a single sed script can do, e.g.
tr '\000' '\012' <out | sed -n -e '1,3s/3.bar/&/p'
> That's just a suggestion, and shouldn't hold up this patch/series. Maybe > just some #leftoverbits :-).
Ditto. The whole thing can be turned into a Perl scriptlet, which may be even easier to read (the cost to spin up one Perl interpreter might be greater than constructing 4 process pipeline on certain systems, though).
Thanks.
P.S. It is nice to hear from you Taylor. It's been a while.