本文介绍了UNIX差异一侧到另一侧的结果吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何绘制的unix diff命令一侧到另一侧,而不是一个差的结果后,其他?请参见下面的例子:
差异的/ tmp / test1的/ tmp目录/ TEST2
1,4c1,2
< asfdsadf
< asdfsad
< FSAF
< fdsadf
---
> asdfsafdsf
> SAF
6,8d3
< SADF
< ASDF
< SADF
10d4
<胎儿酒精中毒综合症
12,13c6,14
< sadfa
< FD
---
> SADF
> SADF
> SADF
> SADF
> SADF
> SADF
> SADF
> SADF
> SAFA
我想有这样的:
差异的/ tmp / test1的/ tmp目录/ TEST2
1,4c1,2
< asfdsadf> asdfsafdsf
< asdfsad> SAF
< FSAF
< fdsadf
---
6,8d3
< SADF
< ASDF
< SADF
10d4
<胎儿酒精中毒综合症
12,13c6,14
< sadfa> SADF
< FD> SADF
---> SADF
> SADF
> SADF
> SADF
> SADF
> SADF
> SAFA
解决方案
从男人差异
,您可以使用 -y
做并排侧。
-y,--side并排
在两列输出
因此,说:
差异-y的/ tmp / test1的/ tmp目录/ TEST2
测试
$猫$ B类
你好你好
我的名字我的名字
是我的就是你
让我们对它们进行比较:
$差异-y A B
你好你好
我的名字我的名字
就是我|是你
How can I plot the results of a unix diff command side-to-side instead of one difference after the other? See below for an example:
diff /tmp/test1 /tmp/test2
1,4c1,2
< asfdsadf
< asdfsad
< fsaf
< fdsadf
---
> asdfsafdsf
> saf
6,8d3
< sadf
< asdf
< sadf
10d4
< fasd
12,13c6,14
< sadfa
< fd
---
> sadf
> sadf
> sadf
> sadf
> sadf
> sadf
> sadf
> sadf
> safa
I would like to have something like:
diff /tmp/test1 /tmp/test2
1,4c1,2
< asfdsadf > asdfsafdsf
< asdfsad > saf
< fsaf
< fdsadf
---
6,8d3
< sadf
< asdf
< sadf
10d4
< fasd
12,13c6,14
< sadfa > sadf
< fd > sadf
--- > sadf
> sadf
> sadf
> sadf
> sadf
> sadf
> safa
解决方案
From man diff
, you can use -y
to do side-by-side.
-y, --side-by-side
output in two columns
Hence, say:
diff -y /tmp/test1 /tmp/test2
Test
$ cat a $ cat b
hello hello
my name my name
is me is you
Let's compare them:
$ diff -y a b
hello hello
my name my name
is me | is you
这篇关于UNIX差异一侧到另一侧的结果吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!