Reputation: 17407
is it possible to get header
or label
on two diff file using diff
or sdiff
command or any other tool. following just example, we have a script which comparing 100s of file so it is good to know which one we are comparing..
currently:
# diff -y --suppress-common-lines /tmp/file1 /tmp/file2
how are you | How are you sir
xxxxxxx
I want header or label something like following so it will looks good in report, otherwise i have to do echo
etc.. to make it work
# diff -y --suppress-common-lines /tmp/file1 /tmp/file2
[file1] [file2]
how are you | How are you sir
xxxxxxx
<
Upvotes: 0
Views: 872
Reputation: 3241
You can using vimdiff
or vim -d
to check the file diff.
vimdiff /tmp/file1 /tmp/file2
Upvotes: 0
Reputation: 88583
Try this or add it to your ~/.bashrc:
function mydiff() { echo -e " [${1##*/}]\t\t\t\t\t\t\t[${2##*/}]"; diff -y --suppress-common-lines $1 $2; }
and use this:
mydiff /tmp/file1 /tmp/file2
Upvotes: 2