I have two files

$ cat file1.txt

$ cat file2.txt

I want to use this command

$ diff --old-group-format=$'\e[0;31m%<\e[0m' --new-group-format=$'\e[0;31m%>\e[0m' --unchanged-group-format=$'\e[0;32m%=\e[0m' file1.txt file2.txt

I got this output with UUXX:3 and UUXX:2 in red and UUXX:1 in green


But I want to make them side by side like this, and keep the UUXX:3 and UUXX:2 in red and both UUXX:1 in green.

UUXX:1                             UUXX:3
UUXX:2                             UUXX:1
  • 1
    sdiff any help here? – steve Jun 1 '18 at 12:15
  • sdiff didn't work the way i want – Noor Jun 1 '18 at 12:17
  • 1
    If you are familiar with vim, vimdiff is a good choice – Thor Jun 1 '18 at 12:55
  • 2
    have you tried -y, diff -y file1.txt file2.txt | colordiff – Siva Jun 1 '18 at 12:59
  • What version of diff do you have? – sys463 Jun 1 '18 at 14:01

This isn't exactly the thing required, but it's similar:

diff  --color=always -y file1 file2

Outputs in red, green, and white:

                                  > UUXX:3
UUXX:1                              UUXX:1
UUXX:2                            <
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.