<div dir="ltr">My approach would have been to use "split" on the original file and then dd the resulting files. But now I find myself wondering how old "split" is. It was certainly already a well-established thing by the early 90s.<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 26, 2023 at 11:23 PM Ralph Corderoy <<a href="mailto:ralph@inputplus.co.uk">ralph@inputplus.co.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Steve,<br>
<br>
> I’ve never figured out how to use ‘dd’ so it returns after a single<br>
> block is written doesn’t close the input, killing the pipeline, or<br>
> cause the rest of the data to be discarded.<br>
<br>
I think this meets your description and complies with POSIX's dd(1p)<br>
here.<br>
<br>
$ seq 33 126 | sed 's/$/P/' | dc |<br>
> while :; do<br>
> LC_ALL=C dd bs=10 count=1 2>dd.err | sed -n l<br>
> grep -q '^[^0].* records in$' dd.err || break<br>
> done<br>
!"#$%&'()*$<br>
+,-./01234$<br>
56789:;<=>$<br>
?@ABCDEFGH$<br>
IJKLMNOPQR$<br>
STUVWXYZ[\\$<br>
]^_`abcdef$<br>
ghijklmnop$<br>
qrstuvwxyz$<br>
{|}~$<br>
$<br>
$ rm dd.err<br>
<br>
I set the locale so the format of dd's stderr report is known.<br>
<br>
-- <br>
Cheers, Ralph.<br>
</blockquote></div>