diffing two ini files

March 22, 2013

Ever need to diff 2 ini files but their sections and options aren’t in the right order?

Well, I do. I googled but I couldn’t find anything trivially available that did this.

I swear I wrote this once before but I couldn’t find it when I looked through my dirs of misc scripts so:


hope it is useful to someone.


4 Responses to “diffing two ini files”

  1. I wonder would sorting be a more functional/unixy operation to provide? Then you could diff <(sortini one.ini) <(sortini two.ini). Also available then are uniq, comm, …

    I might just add a –sort option to http://github.com/pixelb/crudini

  2. skvidal Says:

    I didn’t know crudini existed, thanks!

    But that makes fine sense to me to add –sort into it.

  3. I just committed a change to crudini in github to support –format=lines, which will support standard UNIX text processing tools. In this case, diff can be done like:

    diff <(crudini –get –format=lines file1.ini|sort) \
    <(crudini –get –format=lines file2.ini|sort)

    If wordpress mangles the above, please see the description at:


  4. skvidal Says:

    I couldn’t get to that github link
    but I did find it here



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: