You can use diff –label=LABEL option to display LABEL instead of file name and timestamp in the context format and unified format.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
## Display LABEL instead of file name and timestamp in the context format and unified format. echo -e "1\n2\n3\n4" > myfile1 ## create some files echo -e "1\n2\n3\n6\n5" > myfile2 diff -u myfile1 myfile2 ## displays file name and timestamp ## returns ## --- myfile1 2022-01-22 10:30:16.604329000 +0530 ## +++ myfile2 2022-01-22 10:30:19.841194500 +0530 ## @@ -1,4 +1,5 @@ ## 1 ## 2 ## 3 ## -4 ## +6 ## +5 diff -u --label=file1 --label=file2 myfile1 myfile2 ## displays labels ## returns ## --- file1 ## +++ file2 ## @@ -1,4 +1,5 @@ ## 1 ## 2 ## 3 ## -4 ## +6 ## +5 |