How can I plot the results of a unix diff command side-to-side instead of one difference after the other? See below for an example:
diff /tmp/test1 /tmp/test2
1,4c1,2
< asfdsadf
< asdfsad
< fsaf
< fdsadf
---
> asdfsafdsf
> saf
6,8d3
< sadf
< asdf
< sadf
10d4
< fasd
12,13c6,14
< sadfa
< fd
---
> sadf
> sadf
> sadf
> sadf
> sadf
> sadf
> sadf
> sadf
> safa
I would like to have something like:
diff /tmp/test1 /tmp/test2
1,4c1,2
< asfdsadf > asdfsafdsf
< asdfsad > saf
< fsaf
< fdsadf
---
6,8d3
< sadf
< asdf
< sadf
10d4
< fasd
12,13c6,14
< sadfa > sadf
< fd > sadf
--- > sadf
> sadf
> sadf
> sadf
> sadf
> sadf
> safa
From man diff
, you can use -y
to do side-by-side.
-y, --side-by-side
output in two columns
Hence, say:
diff -y /tmp/test1 /tmp/test2
$ cat a $ cat b
hello hello
my name my name
is me is you
Let's compare them:
$ diff -y a b
hello hello
my name my name
is me | is you