3

I used to use Examdiff on windows which is great because it shows diff with respect to the file type like comparing JSOON or sort INI files before comparing.

On Linux I found beyond compare which does everything that Examdiff does, but not as easy as Examdiff, also it is not open source. So I need a GUI diff program that:

  1. Has plugins (file type preset like file sorting)
  2. does folder compare
  3. preferably open source

UPDATE: To explain what I mean with plugins I will give two examples

First I will compare the following files:

  1. 1.json:

    {
      "name": "test app",
      "version": "0.1",
      "release_date": "2_2_2002",
      "kernel": "4.14",
      "username": "root",
      "password": "1234",
    }
    
  2. 2.json

    {"name": "test app","version": "0.1","release_date": "2_2_2002","kernel": "4.14","username": "root","password": "1234",}
    

You can see that these JSON files are identical in content except that the first one is indented properly (beautified) while the second one is minified.

So if I run any comparison tool on these files I would get many differences.

Running meld:

running meld

while if I run Examdiff on these files it detects that these are JSON files so it uses a plugin and passes these files to a small utility that beautifies these files before comparing(All this is done under the hood of course).So after comparing it shows that the files are identical

enter image description here

The second example is INI files:

  1. 1.ini

    [info]
    ShortName=EN
    
    [main]
    var1=Yes
    var2=No
    var3=Abort
    var4=Ignore
    var5=OK
    var6=Cancel
    var7=Retry
    var8=All
    var9=Help
    
  2. 2.ini

    [main]
    var1=Yes
    var6=Cancel
    
    
    var5=OK
    
    var9=Help
    
    var2=No
    var3=Abort
    
    var4=Ignore
    var7=Retry
    var8=All
    
    
    
    [info]
    ShortName=EN
    

In INI files, the order of the key=value pairs doesn't matter as long as they are in the same sections and empty lines also don't matter

so again running meld shows a lot of differences:

enter image description here

while running Examdiff shows that they are identical (this time it uses another plugin which relies on a utility called INIsorter)

enter image description here

1

Not really an answer, but in the meantime some filters can be simulated with bash process substitution and various utils:

  1. For .json files, using mlr and jq:

    meld  <(mlr --json cat 1.json | jq -M '.' ) \
          <(mlr --json cat 2.json | jq -M '.' )
    
  2. For .ini files, using crudini:

    meld <(crudini --get --format=lines 1.ini|sort) \
         <(crudini --get --format=lines 2.ini|sort)
    

One defect of such methods is that meld doesn't display the filenames, (1.json, etc.), it displays the process substitution device numbers from which one must deduce the corresponding filename.

  • I'd suppose that jq alone would be sufficient, (i.e. jq -M 1.json), but without mlr it returns the error "parse error: Expected another key-value pair at line 8, column 1". – agc Mar 31 '18 at 19:11
0

Meld

I don't know Examdiff and thus, I don't understand what you mean by "file type preset like file sorting", but Meld is a great tool for comparing files and folders.

  1. Does not have addons.
  2. Does folder compare
  3. Is open source

meld screenshot

  • I'm aware of meld and it doesn't have the feature that I need the most (plugins).Please see my updated question o understand what I mean – MOHAMMAD RASIM Mar 3 '18 at 15:54

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.