单向差异文件 [英] One-way diff file

查看:123
本文介绍了单向差异文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想生成的diff做一个SQL数据库的增量备份的缘故。

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

使用标准UNIX'差异'工具生成不必要的大文件,因为它们包含已删除行的全文。我只需要支持,以便能够在一个方向打补丁(生成从完全转储和增量的补丁当前数据库转储)。

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).

我将如何去这样做呢?到目前为止,我曾尝试用差异-e和-e补丁,但它似乎并没有被正常工作,因为生成的文件已损坏(可能在Cygwin中使用的'编'工具的问题)

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)

推荐答案

早在旧时代,Vim前,曾经有被称为ED面向行的UNIX编辑器。

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

差异具有内置的(-e选项)选项,通过它可以从差异创建一个修改剧本

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

下面是一个例子:

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

另一种方式来做到这一点是创建一个补丁文件(见人的补丁')

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

这篇关于单向差异文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆