You can use diff –left-column option to output only the left column of common lines in side-by-side 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 29 30 |
## Display only the left column of common lines echo -e "1\n2\n3\n4" > myfile1 ## create some files echo -e "1\n2\n3\n6\n5" > myfile2 diff --left-column -y myfile1 myfile2 ## displays left column of common lines ## returns ## 1 ## ( ## 2 ## ( ## 3 ## ( ## 4 ## | 6 ## ## > 5 diff -y myfile1 myfile2 ## without --left-column option ## returns ## 1 ## 1 ## 2 ## 2 ## 3 ## 3 ## 4 ## | 6 ## ## > 5 |