3

I have two files

$ cat file1.txt
UUXX:1
UUXX:2

$ cat file2.txt
UUXX:3
UUXX:1

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

UUXX:3
UUXX:1
UUXX:2

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

1 Answer 1

1

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                            <

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .