From: Ivan Shmakov on
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Over the years, I've learned some ways to handle binary data
(mostly numeric) using Shell. E. g.:

$ head -c $((4 * $N)) < FILE
— gives the first $N ‘floats’ (or 32-bit integers, or whatever of
the size 4) of the FILE, while:

$ tail -c $((4 * $N)) < FILE
— gives the last;

$ od -An -w8 -t f8 < FILE
— converts a sequence of ‘double’s to the text format; (GNU Awk
becomes of immense use then);

$ (cat < FILE ; dd if=/dev/zero bs=1 \
count=$((1024 - $(wc -c < FILE))))
— gives the file padded with zeros to the integral number of
kibibytes;

$ (echo P5 "$w" "$h" 255 ; cat) < FILE > FILE.pgm
— makes a portable graymap (PGM) out of the $w × $h, 0 ... 255
binary file.

Now, it makes me wonder, whether there are other tools to
process binary (headerless) data from the Shell? There seems to
be only a handful of other tools (zImg and NetPBM's rawto... and
...toraw come to mind.)

- --
FSF associate member #7257
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkti7jsACgkQMBO2oCMOM0oRjQCeNnDOMuJnTaPy1PIiKSROJdsD
8ZAAoNLWx7w4h64Z3ulWNCVmrL+onRMX
=cII+
-----END PGP SIGNATURE-----
From: Ivan Shmakov on
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

>>>>> "IS" == Ivan Shmakov <ivan(a)main.uusia.org> writes:

IS> Over the years, I've learned some ways to handle binary data
IS> (mostly numeric) using Shell. E. g.:

[...]

IS> Now, it makes me wonder, whether there are other tools to process
IS> binary (headerless) data from the Shell? There seems to be only a
IS> handful of other tools (zImg and NetPBM's rawto... and ...toraw
IS> come to mind.)

Funny enough, but checking my personal e-mail archive at the
point of time almost 2.5 years in the past, I've found that I
was recommended to take a glance on Generic Mapping Tools (GMT;
thanks Michael Perdue once again), but never really followed the
advice.

I'm going to take a look at it soon...

PS. ... But it seems very benefical to never delete an e-mail.

- --
FSF associate member #7257
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAktnFWAACgkQMBO2oCMOM0oX1gCgz07ntyXfeFGX1EwIz0pjMsUc
4goAn1eYcMqCvhzE4OlOmQPLM5qQWQcf
=jIaR
-----END PGP SIGNATURE-----