[COFF] Shell script advice: using 'dd' to write multiple media

Adam Thornton athornton at gmail.com
Tue Jun 27 16:28:24 AEST 2023


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.

On Mon, Jun 26, 2023 at 11:23 PM Ralph Corderoy <ralph at inputplus.co.uk>
wrote:

> Hi Steve,
>
> > I’ve never figured out how to use ‘dd’ so it returns after a single
> > block is written doesn’t close the input, killing the pipeline, or
> > cause the rest of the data to be discarded.
>
> I think this meets your description and complies with POSIX's dd(1p)
> here.
>
>     $ seq 33 126 | sed 's/$/P/' | dc |
>     > while :; do
>     >     LC_ALL=C dd bs=10 count=1 2>dd.err | sed -n l
>     >     grep -q '^[^0].* records in$' dd.err || break
>     > done
>     !"#$%&'()*$
>     +,-./01234$
>     56789:;<=>$
>     ?@ABCDEFGH$
>     IJKLMNOPQR$
>     STUVWXYZ[\\$
>     ]^_`abcdef$
>     ghijklmnop$
>     qrstuvwxyz$
>     {|}~$
>     $
>     $ rm dd.err
>
> I set the locale so the format of dd's stderr report is known.
>
> --
> Cheers, Ralph.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.tuhs.org/pipermail/coff/attachments/20230626/b3c8db39/attachment.htm>


More information about the COFF mailing list