How to create a PATCH file for the binary difference output file

前端 未结 4 1869
逝去的感伤
逝去的感伤 2021-02-08 05:02

I want to know how to create a PATCH for the difference file I got by comparing two binary files. $cmp -l > output file name

I checked for text files \'diff\" can be

4条回答
  •  南方客
    南方客 (楼主)
    2021-02-08 05:38

    If you still want to use diff & patch. Here is a way... Write a c program yourself to insert a newline character at the end of every 512/1024/your_choice bytes (this is just to fool the diff as it compares the files line by line). Run this script on your two input files.

    Then run 'diff -au file1 file2 > mod.diff (you will get the patch here)'

    Patching is simple 'patch < mod.diff'

    Than again write a program to remove the newlines from the binary file. That is all...

提交回复
热议问题