I am trying to a salvage an old scratched DVD by ripping it to ISO. I have two readers and created an ISO from each. Each reader is unable to read certain different bytes of the DVD and replaces them with 0s. When I compare the files using cmp -l file1.iso file2.iso
, I see that certain bytes on the left are 0 while certain other bytes on the right are 0 (the corresponding bytes on the other files are non-zero). I want to create a 3rd file, say file3.iso
that merges the non-zero differing bytes from the above two files. As an example, assume for simplicity that each file has 6 bytes as follows
file1.iso file2.iso
--------- ---------
0 0
1 1
2 0
3 0
0 4
0 5
file3.iso
should be as follows:
0
1
2
3
4
5
The files are quite large (around 8GB). Each file has the same number of bytes. I am using Ubuntu 16.04
Can anyone suggest the easiest way to do what I want. I can use the output of cmp -l
as intermediate data but want to avoid writing code.
I wrote a Python script for you.
Make it executable then call it like so:
Or for short:
P.s. I've recently been studying reading files in different ways, so this is nice serendipity.