[clug] 'dd' command detecting EOF: an example script

Luke Mewburn lukem-clug at mewburn.net
Thu May 16 06:36:23 UTC 2019

On 19-05-15 09:43, steve jenkin via linux wrote:
  | I’d like to run a command on each 32k block of a file, the only way
  | I could think of, without writing some code, was to use ‘dd’.
  | [Saw this done once to break a tar file into pieces to fit on floppy
  | disks. Hadn’t remembered how the loop terminated.]
  | If anyone has a better, or newer, way to do this, I’d appreciate
  | suggestions.

I'd have written some python, reading the file with fp.read(32768),
process with subprocess.Popen([cmdargv,], ...).

I find it's more hassle than it's worth to write shell scripts
with reasonable error handling, especially dealing with tool
differences across different platforms and versions.

More information about the linux mailing list