|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
If you get the same file again and again, and you want to see what’s
different, the canonical method is to use the
It will list for you those records that are unique to each file, and
those that appear to have changed. One drawback is that it requires
the records in the two files to be in the same order. Another is that
it does not pay attention to the key fields that may be important to
When I want to find the changes in a file, including additions,
deletions, and any changes for the information about a key I normally
use 4 applications of
combine. One command is suffucuent to
find the new keys. One is enough to find those that are no longer there.
A third finds everything that is different, and the fourth finds the
before and after image of keys whose information has changed.
As an example, suppose my bridge club’s roster has a name and a phone number, separated by commas, for each member. The following four commands will identify the new members, the departed members, and those whose phone number has changed.
%# Reference file is optional, so unmatched data records will have %# 2 blank fields at the end. % combine -D , -d , -w -o 1-2 -r old_roster.txt -D , -k 1 -m 1 -p \ -o 1-2 inew_roster.txt | grep -v ' , $' > new_member.txt %# Data file is optional, so unmatched reference records will have %# 2 blank fields at the beginning. % combine -D , -d , -p -w -o 1-2 -r old_roster.txt -D , -k 1 -m 1 \ -o 1-2 inew_roster.txt | grep -v '^ , ' > departed_member.txt %# Both files are optional, so any unmatched records will have %# blank fields at the beginning or end. Here we match on the %#entire record rather than the key as in the above two examples. % combine -D , -d , -p -w -o 1-2 -r old_roster.txt -D , \ -k 1-2 -m 1-2 -o 1-2 -p inew_roster.txt | grep -v ' , ' \ > all_changes.txt %# Match up the before and after versions of an entry to see changes. % combine -D , -d , -w -o 1-2 -r all_changes.txt -D , -k 3 -m 1 -o 2 \ all_changes.txt | grep -v ' , ' > changed_member.txt
TO BE CONTINUED
|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]|
This document was generated by Daniel P. Valentine on July 28, 2013 using texi2html 1.82.