

bin/rm $ufile1 $ufile2As usual, to run the script you need to save it in a file (mdiff, for example) and make that file executable (chmod 755 mdiff) and put the file in a directory in your path. # We create temporary files ufile1 & ufile2 with \r changed to \n # since then user could supply options to diff # As a future enhancement, should use the last two args # Note: the quotes are necessary since filenames might have spaces in them # This script expects two filename arguments on the command line # that use the traditional Macintosh line ending: \r # Provides the equivalent of 'diff' for comparing files I haven't spent the time to polish up this script so I'm sure that some readers will contribute improved versions here's the current incarnation: #!/bin/csh -f Read the rest of the article for the script.
#Macos diff two files mac#
An example is iMovie - its project files are editable text but they use "\r" and hence cannot be usefully compared with 'diff'.Īll of the above was a long-winded motivation for the following shell script (for use in the Terminal) which provides a 'diff' comparison of two traditional Mac ("\r") files. OS X itself and most OS X applications use "\n" as the end-of-line marker, but some applications which exist in both OS 9 and OS X versions use the traditional Mac "\r" end-of-line marker for their files.

the plist files holding preference information).īut it isn't useful for comparing files which use the traditional Mac end-of-line marker ("\r") since the 'diff' utility, like most UNIX tools, expects lines to be ended with "\n". It works well for all UNIX text files, including most of those you will encounter in OS X (e.g. The standard UNIX (command-line) utility 'diff' compares two text files, showing you the lines which differ between the two.
