Diff, Patch, and Friends(diff, patch和他们的相关工具)(第一篇)

原文 http://www.linuxjournal.com/article/1237
翻译: ykyi.net

“Kernel patches” may sound like magic, but the two tools used to create and apply patches are simple and easy to use—if they weren't, some Linux developers would be too lazy to use them…
"内核补丁"听起来相当之神奇,但是有两个用来创建补丁和应用补丁的工具却简单易用。如果它们很难用的话,一些Linux开发者才懒得用它们呢。

Diff is designed to show you the differences between files, line by line. It is fundamentally simple to use, but takes a little practice. Don't let the length of this article scare you; you can get some use out of diff by reading only the first page or two. The rest of the article is for those who aren't satisfied with very basic uses.
diff这个工具设计成可以向你展示文件之间行与行的区别。它使用起来是相当的简单,但需要一点练习才习。你千万不要让长长的介绍文档把你吓住。你可以先只读前一两页文档,这样你就可以使用diff来开展一些工作了。余下的diff介绍文档是写给那些对基本用法非常不满的奇异人士的。 http://ykyi.net

While diff is often used by developers to show differences between different versions of a file of source code, it is useful for far more than source code. For example, diff comes in handy when editing a document which is passed back and forth between multiple people, perhaps via e-mail. At Linux Journal, we have experience with this. Often both the editor and an author are working on an article at the same time, and we need to make sure that each (correct) change made by each person makes its way into the final version of the article being edited. The changes can be found by looking at the differences between two files.
diff被开发者用来同一个源文件的比较不同版本之间的区别。这还可以有很多其它的用途。比如,当编辑一个在很多人之间通过email传递的文档时,diff工具非常方便。在Linux Journal网站,我们经历过这些。编辑和作者同时修改同一个文章的情况非常常 见,我们需要确保每个人所作的修改都被正确应用到这篇文章的正确位置。被修改的部分可以通过比较两个文件的区别得到。

However, it is hard to show off how helpful diff can be in finding these kinds of differences. To demonstrate with files large enough to really show off diff's capabilities would require that we devote the entire magazine to this one article. Instead, because few of our readers are likely to be fluent in Latin, at least compared to those fluent in English, we will give a Latin example from Winnie Ille Pu, a translation by Alexander Leonard of A. A. Milne's Winnie The Pooh (ISBN 0-525-48335-7). This will make it harder for the average reader to see differences at a glance and show how useful these tools can be in finding changes in much larger documents.
但是,要让你清楚的知道diff工具在查找文件之间的区别方面是多么有用是用点难度的。要向你清楚展示diff的所有所有功能,需要整个Linux Journal杂志这么大的篇幅来介绍(zausiu: 这句话我不太确定有没有译对)。我不这样做,由于比较少一部分人可以流利读懂拉丁文,至少同能够读英文的人数相比可以读拉丁文的是少数派,我给出一个用拉丁文的例子。这样一来,一般人就不太能一眼看出不同之处来,你就能够理解diff用来查找大文件之间的区间是多么有用了。http://ykyi.net

Quickly now, find the differences between these two passages:
废话少说,找找下面两段话的区别:

Ecce Eduardus Ursus scalis nunc tump-tump-tump
occipite gradus pulsante post Christophorum
Robinum descendens. Est quod sciat unus et solus
modus gradibus desendendi, non nunquam autem
sentit, etiam alterum modum exstare, dummodo
pulsationibus desinere et de no modo meditari
possit. Deinde censet alios modos non esse. En,
nunc ipse in imo est, vobis ostentari paratus.
Winnie ille Pu.

Ecce Eduardus Ursus scalis nunc tump-tump-tump
occipite gradus pulsante post Christophorum
Robinum descendens. Est quod sciat unus et solus
modus gradibus descendendi, nonnunquam autem
sentit, etiam alterum modum exstare, dummodo
pulsationibus desinere et de eo modo meditari
possit. Deinde censet alios modos non esse. En,
nunc ipse in imo est, vobis ostentari paratus.
Winnie ille Pu.

You may be able to find one or two changes after some careful comparison, but are you sure you have found every change? Probably not: tedious, character-by-character comparison of two files should be the computer's job, not yours.
如果你仔仔细细,认认真真地比较,你能够发现一到两个不同之处。但是你可以保证你找到了所有的不同之处了吗?不!逐字的比较文件之间的不同是电脑的专长,而不是你--humanbeing ! 

请看第二篇。

copyright ykyi.net