Skip to content

Differencing two similar text files

There is a faily brain-dead unix utilitiy for differencing two files:

diff file1 file2

There is a lovely graphical version on linux called kompare. i highly recommend it (jmw).

Its output can be exported as text to send to distant colleagues. Furthermore the following diff command gives similar (text) output – much to be preferred to raw diff:

diff -U 3 -dHrN — file1 file2

(the 3 means it places 3 lines of context around the change to help you visualize it)

–Joel

Published inUnix Hint

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *