diff命令标签格式

时间:2015-05-06 15:16:32

标签: linux bash scripting diff

是否可以使用headerlabel命令或任何其他工具在两个差异文件上获取diffsdiff。仅举几个例子,我们有一个比较100个文件的脚本,所以很高兴知道我们正在比较哪个..

目前:

# diff -y --suppress-common-lines /tmp/file1 /tmp/file2
    how are you                                                   | How are you sir
    xxxxxxx

我想要标题或标签之类的内容,以便它在报告中看起来不错,否则我必须做echo等...才能使其正常工作

# diff -y --suppress-common-lines /tmp/file1 /tmp/file2
    [file1]                                                            [file2]
  how are you                                                   | How are you sir
  xxxxxxx
                                                   <

2 个答案:

答案 0 :(得分:2)

试试这个或将其添加到〜/ .bashrc:

function mydiff() { echo -e " [${1##*/}]\t\t\t\t\t\t\t[${2##*/}]"; diff -y --suppress-common-lines $1 $2; }

并使用此:

mydiff /tmp/file1 /tmp/file2

答案 1 :(得分:0)

您可以使用 double[,] factors = new double[3, 3] { { 1.0, 1.0/12, 1.0/12/3 }, { 12.0, 1, 1.0/3 }, { 12*3,3,1 } }; const int Inches = 0; const int Feet = 1; const int Yards = 2; var result = factors[Yards, Inches] * 1; vimdiff来检查文件差异。

vim -d