Thursday, July 31, 2008

diff -u --to-file=

This is dumb, but I am a dumb guy, so I find it useful.

I am always getting 'diff -u file1 file2' out of order... as in, sometimes I execute:

diff -u file1 file2, but what I really needed was: diff -u file2 file1

...

A way to make sure that you always get the result you want, independent of the order fed to diff is by using the '--to-file=' option.


diff -u --to-file=file1 file2


Gives me the results I want.

Like I said, dumb, but handy.

0 comments: