Home Programmierung Powerful Diff with LISP

Main Menu

Texte / Essays
Powerful Diff with LISP

Productive Systems Analysis requires powerful Tools --I created one for some Analysis Tasks.

Sometimes, as a Systems Analyst or a Business Analyst, you have to compare two ASCII Files.
Let us assume...

  • you have two Text Files, one record per line, separated by whitespaces,
  • with identical column structure,
  • and the first column being the key.

You would like to know

  • what the differences of certain columns for keys in both files are and
  • if there are any keys which are present only in File1 or File2.

Still being a LISP Beginner, I decided to create a tool which allows me to compare two Text Files with some Features:

  • It allows me to choose which columns of the text file to load.
    Sometimes you only need a few columns. First Column is always the key.
  • It allows to define which column number is the one to look for differences.
  • It also looks for unique keys in each file.

My Lisp File has only around 80 Lines of code. It uses Edi Weitz´ cl-ppcre to split lines by whitespace.
And there are certainly some more elegant ways to implement some functions. But the code does the job.

Here are my Sample Input Test Files (in German Language)....



....and here is the sample output in the REPL:



And here is the code.

Written by Sebastian K. Glas, 2012-06-07.