I have binary files which contain data structures of various length. I would like to save these blocks of data into separate files. The size of each block is known. The split command can, well, split a file but it does not stop after the first block of data. It slices the file into pieces of equal size.
Therefore, my current solution is to split and cat the remainder of the file back together, iterating my way through the data. This is very clumsy and may even fail in certain circumstances.
What is the best way to slice a binary file precisely at certain positions?
dd.ddlets me copy the first block of arbitrary size, but then I can skip only at multiples within the input and output files, respectively. I would need offset and block size as independant parameters.