I am looking for an application that will diff two files, and actually ignore all whitespace, so for example:
class foo {
bar
spaz
}
is equally equivilant to
class foo{bar spaz}
or, as well
classfoo {
barspaz}
but NOT
classfoo {
spazspaz
}
i.e. it would show me that spaz
in the previous example has taken the place of bar
in any of the other examples. It only needs to compare 2 files.
- It can be a windows or linux/unix/posix-compatible utility
- I've tried the lin/unix
diff -w
command, it only ignores whitespace if the difference per-line is whitespace. I don't see an option to totally ignore whitespace. - I also tried UECompare or Ultracompare, a non-free comparison utility for windows.
Best Answer
Are you looking for something like the
tr
command? Here are the manpages. It's included withmsysgit
,cygwin
, andgnuwin32 tools
as far as I can tell.So you can remove all the whitespace prior to diffing by doing something like:
You can then feed the output of that command to
diff
and have it work without having any whitespace.For example, I have a file named
HelloWorldApp.java
. Let me show you howtr
processes it: