使用diff手动合并两个文件 [英] Manually merge two files using diff
本文介绍了使用diff手动合并两个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想通过以下操作合并两个文件:
I'd like to merge two files by doing the following:
- 将两个文件的差异输出到临时文件中,然后
- 手动选择要复制/保存的行.
这里的问题是diff -u
仅给了我一行文件上下文,而我想以统一格式输出整个文件.
The problem here is that diff -u
only gives me a file lines of context, while I want to output the entire file in a unified format.
diff有什么方法可以做到这一点吗?
Is there any way diff can do this?
推荐答案
我想以统一格式输出整个文件.diff有什么方法可以做到这一点?"
"I want to output the entire file in a unified format. Is there any way diff can do this?"
是的
diff -U 9999999 file1.txt file2.txt > diff.txt
只要您的文件少于1000万行,这应该可以工作.
This should work, provided your files are less than 10 million lines long.
这篇关于使用diff手动合并两个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文