忽略带有diff的换行符 [英] Ignore newlines with diff

查看:143
本文介绍了忽略带有diff的换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我比较c源文件时,我想忽略换行符。例如,我要报告以下两个代码相同。

I'd like to ignore newlines when I compare c source files. For example I want following two codes are reported they are same.

// codeA
int main(int argc, char *argv[]) 
{

// codeB
int main(int argc, char *argv[]) {

我已经尝试过以下选项,但无法获得结果。

I already have tried following options but could not get the result.

diff -b codeA codeB
diff -w codeA codeB


推荐答案

您可以使用例如GNU Indent, http: //www.gnu.org/software/indent/ ,然后将它们与diff进行比较。

You can pretty print both files using, for example, GNU Indent, http://www.gnu.org/software/indent/ , and then compare them with diff.

这篇关于忽略带有diff的换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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