diff in ‘nix environments

After a long silence… he surfaces!  I have a couple of things to say, but I’m going to start with a very simple pleasure: diff.  First, let me clarify that I generally love the command line.  But in a world of many different pieces that all have different importance, I have come to appreciate what GUI tools have to offer.  I find the compare functionality in something like eclipse to be handy in an efficiency++ way.  So when I go back to the command line for something like this, it is because nothing else can truly replace it… like the beauty that is vi.  ;D

The short story is this:  diff -w -B -y -W 200 {file1} {file2}

Now some of you are reading that and saying, “No kidding.  Welcome to the real world.”  The rest of you may be saying “gonk… gonk… goo gonk.”  So to quote the help on diff:

  • -w:  ignore all white space (like tab expansions and changes to white space)
  • -B:  ignore changes whose lines are all blank (just in case the above is finicky)
  • -y:  output in two columns
  • -W 200:  make the output 200 columns wide (this permits both files to be displayed in full width, with room, assuming 80 char width)

I have yet to find a graphical diff tool that can manage that so nicely.  The side-by-side output is very clean and I can redirect it to a file if I want to.  Smooth, simple, elegant.  And if there’s a way to improve on this, I hope a casual passerby will comment!

Ciao!

Advertisements

About John

I write about technology interests, cooking, and my own writing (sci-fi and fantasy... sometimes both). I try to keep things light, but sometimes I get side-tracked on an issue that I feel strongly about. No offense is meant, I'm just like any other person who feels strongly about something when I write. View all posts by John

Comments are disabled.

%d bloggers like this: