diff -- a short tutorial
Posted: Tue Nov 13, 2012 7:09 am
Here are some useful tips.
To determine globally the differences from one AGEOD release to the next, try for example:
Robert@roberto /home/Robert/Games/AGEOD/agelint
$ diff -r "/cygdrive/c/Games/AGEOD/Revolution under Siege 1.06" "/cygdrive/c/Games/AGEOD/Revolution under Siege" | tee RUS_1.06_1.06a.diff
The '| tee RUS_1.06_1.06a.diff' "pipes" the diff command output to the tee command, which sends the output to both screen and the indicated file, RUS_1.06_1.06a.diff.
If you prefer, you could use
Robert@roberto /home/Robert/Games/AGEOD/agelint
$ diff -r "/cygdrive/c/Games/AGEOD/Revolution under Siege 1.06" "/cygdrive/c/Games/AGEOD/Revolution under Siege" > RUS_1.06_1.06a.diff
which outputs just to the file.
To determine the differences between two folders, try for example:
Robert@roberto /home/Robert/Games/AGEOD/agelint
$ diff -r "/cygdrive/c/Games/AGEOD/Revolution under Siege 1.06/RUS/Events" "/cygdrive/c/Games/AGEOD/Revolution under Siege/RUS/Events" | tee RUS_Events.diff
To determine the differences between two files, try for example (note the absence of the '-r' option):
Robert@roberto /home/Robert/Games/AGEOD/agelint
$ diff "/cygdrive/c/Games/AGEOD/Revolution under Siege 1.06/RUS/Events/GRNAI.sct" "/cygdrive/c/Games/AGEOD/Revolution under Siege/RUS/Events/GRNAI.sct" | tee GRNAI.sct.diff
A really useful option to try is -c #, as in
Robert@roberto /home/Robert/Games/AGEOD/agelint
$ diff -c "/cygdrive/c/Games/AGEOD/Revolution under Siege 1.06/RUS/Events/GRNAI.sct" "/cygdrive/c/Games/AGEOD/Revolution under Siege/RUS/Events/GRNAI.sct" | tee GRNAI.sct.diff
which shows context around the diffs of, by default, 3 extra lines. You can control the amount of context, as in
Robert@roberto /home/Robert/Games/AGEOD/agelint
$ diff -C 9 "/cygdrive/c/Games/AGEOD/Revolution under Siege 1.06/RUS/Events/GRNAI.sct" "/cygdrive/c/Games/AGEOD/Revolution under Siege/RUS/Events/GRNAI.sct" | tee GRNAI.sct.diff
which would extend the context to 9 surrounding lines, before and after.
And so on. Like most Unix/Linux commands, there are a ton of options available. If you have the so-called Cygwin "man[ual] pages" installed in your setup (in Linux, the man pages would be installed by default), you might try the command
$ man diff
It pays to learn some of this Unix/Linux stuff. You might be surprised at what you find. [;)]