如何在目录之间的递归并排差异中显示文件的行号

时间:2016-08-26 15:20:54

标签: shell unix recursion diff line-numbers

我希望在两个目录之间的递归并排差异中显示与文件 [not generate] 关联的行号。要显示diff中文件的行号,我使用的命令是:

diff -y <(cat -n abc1.txt) <(cat -n abc2.txt)

但是对于目录,怎么做?

diff -y folder1 folder2

预期输出为:

folder1/file1a.txt      folder2/file2a.txt
                           >  1 
1 This is original content |  2 This is changed content

folder1/file1b.txt      folder2/file2b.txt
                                   >  1
                                   >  2
1 This is another original content |  3 This is another changed content 2

有没有像使用xargs之类的解决方案,因为我观察到的是递归diff实际上对目录中的每个文件都有差异,所以无论如何在diff执行之前使用xargs在粒度级别附加行号特定文件的命令?有什么好主意的人????

0 个答案:

没有答案