使用 diff 并抑制完全不同的文件
我有两个应用程序源代码的副本。一份副本已编码,而另一份则未编码。配置文件分散在应用程序的目录结构中,这就是我想要比较的。
有没有一种方法可以使用 diff 来忽略截然不同的文件(即:加密文件和未加密文件),并且仅报告相似但不同的文件(配置)上的差异。
I have two copies of an application source code. One copy is encoded, while the other is not. There are config files scattered through-out the application's directory structure, and this is what I would like to compare.
Is there a way to use diff where-by I can ignore the wildly different files (ie: An encrypted file and an unencrypted file), and only report the difference on the similar-yet-different files (The configs).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以编写一个脚本,使用
find
根据名称或其他条件查找文件,并使用file
来确定它们是否具有相同类型的内容(即,一个是压缩的,一个是压缩的)不是)。更具体地说,我需要您提供更多详细信息,说明这些是否是并行目录结构(文件和目录出现在两个树中的相同位置)以及您正在查找的文件是否具有将它们与文件区分开的名称你想忽略。您可以提供的任何其他信息可能会有所帮助。
You could write a script that uses
find
to find the files based on name or other criteria andfile
to determine whether they have the same type of contents (i.e. one compressed, one not).For me to be more specific I would need you to give more details about whether these are parallel directory structures (files and directories appear in the same places in the two trees) and whether the files you are looking for have names that distinguish them from files you want to ignore. Any additional information you can provide might help even more.