My scenario is to perform side by side diff directories using:
diff -ry <folder1> <folder2>
along with the line numbers in the diff output. By default line numbers are not displayed in the side by side diff and the parameter --new-line-format
doesn't work along with diff -y
only works with diff -u
.
What i have tried is to do [For files only]:
diff -y <(cat -n file1) <(cat -n file2)
to generate line numbers. The above command first generates line numbers and then passes it to diff command, so the line numbers are kept intact in the diff result.
But when it comes to use diff -ry
, i am unable to do it. Is there any way to apply cat -n using something like xargs
[like a preprocessor] in the diff -ry
command ?