(plain) text is (still) the universal “interface” or “format”

processing, viewing, diffing text is important to stop small changes in otherwise extensive and identical config files.

the heavy weight eclipse gui diff:

an optical nice diff brings the otherwise slow and clumsy (resource intense) “eclipse diff” (select two files -> r-click -> compare with -> each other).

if hotkeys / shortcuts were properly configured, it was even possible to line-by-line copy changes left-to-right or right-to-left (side-by-side view)

diff is important

another example:

the terminal diff:


hostnamectl; # tested on/with
  Operating System: Debian GNU/Linux 10 (buster)
            Kernel: Linux 4.19.0-10-amd64
      Architecture: x86-64

# create two test files
cat file1.txt
This is the first line.
This is the second line, with changes in file1.txt
This line is the same in both files.
Wonder how well it will diff.
A good visual diff is important, some users are fine with the green and black of the command line.
the command line and command line tools are very powerful and resource efficient..

cat file2.txt
This is the first line, with changes in file2.txt
This is the second line.
This line is the same in both files.
Wonder how well it will diff.
A good visual diff is important, some users prefer more colorful and graphic guis.
gui tools need more computational resources but some have very nice features.

# default diff only computers can read well
diff file1.txt file2.txt
1,2c1,2
< This is the first line.
< This is the second line, with changes in file1.txt
---
> This is the first line, with changes in file2.txt
> This is the second line.
5,6c5,6
< A good visual diff is important, some users are fine with the green and black of the command line.
< the command line and command line tools are very powerful and resource efficient..
---
> A good visual diff is important, some users prefer more colorful and graphic guis.
> gui tools need more computational resources but some have very nice features.

# means
< is a difference in the first file
> is a difference in the second file

# this is a bit better than "computermode" but still confusing X-D
# guess without color marking spotting changes in same lines is hard
diff -c file1.txt file2.txt
*** file1.txt 2020-09-26 13:19:45.990931729 +0200
--- file2.txt 2020-09-26 13:20:04.611719634 +0200
***************
*** 1,6 ****
! This is the first line.
! This is the second line, with changes in file1.txt
This line is the same in both files.
Wonder how well it will diff.
! A good visual diff is important, some users are fine with the green and black of the command line.
! the command line and command line tools are very powerful and resource efficient..
--- 1,6 ----
! This is the first line, with changes in file2.txt
! This is the second line.
This line is the same in both files.
Wonder how well it will diff.
! A good visual diff is important, some users prefer more colorful and graphic guis.
! gui tools need more computational resources but some have very nice features.

# this seems to be the diff mode git is using per default
# still confusing
diff -u file1.txt file2.txt
--- file1.txt 2020-09-26 13:19:45.990931729 +0200
+++ file2.txt 2020-09-26 13:20:04.611719634 +0200
@@ -1,6 +1,6 @@
-This is the first line.
-This is the second line, with changes in file1.txt
+This is the first line, with changes in file2.txt
+This is the second line.
This line is the same in both files.
Wonder how well it will diff.
-A good visual diff is important, some users are fine with the green and black of the command line.
-the command line and command line tools are very powerful and resource efficient..
+A good visual diff is important, some users prefer more colorful and graphic guis.
+gui tools need more computational resources but some have very nice features.

bring some color in the diff:

in theory user could install:

apt install colordiff

but that seems to be exactly what:

diff --color file1.txt file2.txt

does as well…

colordiff default output example:

where colordiff is indeed “better” than diff is with:

diff -y --color file1.txt file2.txt
       -y, --side-by-side
              output in two columns

this is as good as it gets today folks, bye’ya

wishes:

per default, better than colorized the whole line (with file1 being red, and file2 being dark green)

it would be great to colorize the exact difference in the lines

otherwise it is left to the user to stop differences in otherwise identical lines

manpages:

diff.man.txt

colordiff.man.txt

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!
admin