I have a set of binary file chunks from a video file. They are partly overlapping.
To exemplify say that the video file binary data can be represented like this: "---ABCDEFGHIJKLMNOPQRSTUVXYZ" where "---" is a header.
The chunks can be represented like this (simplified because there are some differences in the header part for each chunk): chunk 1: "---ABCD" chunk 2: "---DEFG" chunk 3: "---GHIJ" chunk 4: "---JKLM" ...
I need a command line tool that merges these files. It should take the end part of chunk 1, search chunk 2 for that pattern, join chunk 1 to the part of chunk 2 from pattern to end (ignoring all data in chunk 2 before the pattern start). Then repeat the operation for all remaining chunks until we have the complete video file.