One-way diff file

不羁岁月 提交于 2019-12-12 04:19:09

问题


I would like to generate diffs for the sake of doing incremental backups of an sql database.

Using the standard unix 'diff' tool generates unnecessarily large files, since they include the full text of deleted lines. I only need support to be able to patch in one direction (to generate the current db dump from the full dump and an incremental patch).

How would I go about doing this? I have tried so far using diff -e and patch -e, but it doesn't seem to be working correctly, as the resulting file is corrupt (possibly an issue with the 'ed' tool used in cygwin)


回答1:


back in the old days, before Vim, there used to be a line-oriented UNIX editor called 'ed' ..

diff has an option built in ( -e option ) , with which you can create an edit script from the diff.

Check here: and look for the section "Edit Script"

http://en.wikipedia.org/wiki/Diff

http://docs.freebsd.org/info/diff/diff.info.ed_Scripts.html

here's an example:

http://www.araxis.com/merge/topic_diff_report_editscript.html


another way to do this is to create a patch file (see 'man patch')



来源:https://stackoverflow.com/questions/7669413/one-way-diff-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!