linux diff工具输出带有相对前缀

时间:2017-08-11 08:38:23

标签: linux diff

带文件路径的 diff 输出太长。我想删除 diff 内置参数/选项可读的路径而不通过 shell脚本

$ diff -u /share/a/b/c/d /share/1/2/3/4/             <== path is too long
diff -u /share/a/b/c/d/dirsave /share/1/2/3/4/dirsave
--- /share/a/b/c/d/dirsave      2017-08-11 16:21:50.100547799 +0800
+++ /share/1/2/3/4/dirsave      2017-08-11 16:22:21.612546684 +0800
@@ -1,2 +1,3 @@
 pushd /share/qca6174/qca6174a-5-pci/QCA6174A-5-PCI/fixce/AIO/rootfs-ra-r105.build/lib/firmware
 pushd /share/qca6174/qca6174a-5-pci/QCA6174A-5-PCI
+libc

然而,这条路对我来说太长了。 我希望像

那样获得简短的路径
diff -u dirsave dirsave                                <== enhance shortly path
--- dirsave     2017-08-11 16:21:50.100547799 +0800
+++ dirsave     2017-08-11 16:22:21.612546684 +0800
@@ -1,2 +1,3 @@
 pushd /share/qca6174/qca6174a-5-pci/QCA6174A-5-PCI/fixce/AIO/rootfs-ra-r105.build/lib/firmware
 pushd /share/qca6174/qca6174a-5-pci/QCA6174A-5-PCI
+libc

0 个答案:

没有答案