Excluding deleted lines from diff output

自作多情 提交于 2019-12-13 05:17:26

问题


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?


回答1:


Use the -e option for both diff and patch, instead of -u.



来源:https://stackoverflow.com/questions/25569575/excluding-deleted-lines-from-diff-output

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