从差异输出中删除已删除的行 [英] Excluding deleted lines from diff output

查看:74
本文介绍了从差异输出中删除已删除的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些我不想引用的原始数据,但是我确实希望能够打补丁。如果我在文件中使用diff -u完全用其他内容替换了它的内容,而不是基本上得到全部删除和所有新行,而是在每行之前使用-得到了整个旧文件。

I have some original data that I do not want to reference, but I do want to be able to patch. If I use diff -u on a file where I entirely replaced its contents with something else, instead of getting basically a 'delete all' plus all the new lines, I get the whole old file with '-' before each line.

我们可以假设原始数据暂时没有变化。

We can assume the original data doesn't change for the moment. Is there a way to get diff to make a patch without duplicating any of the original data with '-' lines, i.e., have it just describe line numbers to delete along the way, and then all the insertions?

推荐答案

diff -e 选项$ c>和补丁,而不是 -u

这篇关于从差异输出中删除已删除的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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