combine(1) combine(1)
NAME
combine, combine2 - compare or combine 2 or 3 source files
SYNOPSIS
combine [-BbHhqs] [-c #,#] [-d flag] [-L #] [-P #] [-p #]
[-1 text] [-2 text]
old_file new1_file [new2_file]
combine2 temp_file merged_file
DESCRIPTION
combine compares the differences between 2 or 3 source files
and produces a result file. Where old_file is the name of
the original file, new1_file is a file containing modifica-
tions to old_file, and new2_file is a file containing a dif-
ferent set of modifications to old_file.
The option arguments are:
-H Help option -- Print a brief help message and exit.
-b Blank compress option -- Causes combine to treat
all sequences of blanks and horizontal tabs as a
single blank.
-B Blank remove option -- Causes combine to ignore all
blanks and horizontal tabs in a line when comparing
lines.
-c #,# Column specification option -- Specifies the column
range to be compared. By default, all columns are
compared. The number of the first column to com-
pare immediately follows the -c option. The number
of the last column to compare is separated from the
first column to compare by a comma. Up to 32 dif-
ferent column ranges may be given.
For example,
combine -c10,20 a b c
compares only columns 10 through 20.
-d flag Debug options -- specifies how much debug informa-
tion is to be output. The possibilities are: -d1,
pass1 debug; -d2, pass2 debug; -d3, pass3 debug;
-d4, pass4 debug; -d5, pass5 debug; and -da, all
debug.
-h h option -- produces a composite file on standard
output suitable for input into combine2(1). The
file is an ASCII text file which may be manually
modified by an text editor such as vi(1). The
example below describes the use of this option in
Page 1 CX/UX User's Reference Manual
combine(1) combine(1)
detail.
-L # Lines option -- Specify the number of lines to be
printed on a page of the standard output file.
Specifying zero lines (-L0) disables pagination of
the output file. The default page length is 66
lines. This option is used only if the -h option
is not specified.
-p # Postfix option -- The number of unchanged lines to
output to the standard output file following any
group of changed lines. The number of unchanged
lines is specified by the argument following the -p
option. The default is 5. This option is used only
if the -h option is not specified.
-P # Prefix option -- The number of unchanged lines to
output to the standard output file prior to any
group of changed lines. The number of unchanged
lines is specified by the argument following the -P
option. The default is 5. This option is used only
if the -h option is not specified.
-q Quiet option -- Specifies that no output is to be
generated to the standard output file if no changes
are detected.
-s Statistics option -- Specifies that performance
statistics are to be output to standard output when
combine is finished.
-1 text New1 file description -- Symbolic description of
the new1 file. This text is printed as the descrip-
tion of the new1 file on the listing output and h
option output file.
-2 text New2 file description -- Symbolic description of
the new2 file. This text is printed as the descrip-
tion of the new1 file on the listing output and h
option output file.
EXAMPLE
combine may be used to perform a simple two file comparison.
by merely omitting the name of the third file.
combine is best suited to do a three file comparison. Con-
sider a file which is being modified along two development
paths. The original copy of the file with no modifications
is called the old file. The copy modified along one
development path is called the new1 file. The copy modified
along the other development path is called the new2 file.
The following is a guide for producing a merged file which
Page 2 CX/UX User's Reference Manual
combine(1) combine(1)
contains both set of modifications.
First, combine is called with the following command line:
combine -h old new1 new2 >temp_file
The temp_file contains all of the lines from the old, new1
and new2 files combined with control lines. A control line
identifies those portions of the temp_file which represent
modifications made by the new1 and new2 files.
Text which is inserted by the new1 or new2 file is sur-
rounded by an ~~Insert line and an ~End line. The ~~Insert
line also contains comments indicating which of the two
files the inserted lines came from and whether the insertion
was involved in a `move' operation. In the example below,
the line `apple' was inserted between two already existing
lines `bob' and `fred'.
bob
~~Insert 'file2'
apple
~End of changes
fred
Text which is deleted by the new1 or new2 file is surrounded
by an ~~Delete line and an ~End line. The ~~Delete line also
contains comments indicating which of the two files deleted
the specified lines an whether the deletion is a side effect
of a `move' operation. In the example below, the line
`apple' was deleted from between the lines `bob' and `fred'.
bob
~~Delete 'file1'
apple
~End of changes
fred
The temp_file may be edited with any text editor. Changes in
the temp_file can easily be found by finding lines with two
tildes (~~) on them. Changes which are correct should be
left alone. Changes which are wrong should be fixed. Deleted
text can be allowed to remain in the file by merely deleting
the ~~Delete line. Things to watch out for during this pro-
cess include: Lines which are inserted by both the new1 and
new2 files, and lines which are deleted by both the new1 and
new2 files.
After all of the changes have been made in the tempfile,
combine2(1) should be used to produce the merged file. Com-
bine2(1) is called with the following command line:
combine2 temp_file merged_file
Combine2(1) produces a merged file by removing the control
lines and the deleted lines from the temp file. If the name
of the temp file is omitted, standard input is used. If the
name of the merged file is omitted, standard output is used.
Page 3 CX/UX User's Reference Manual
combine(1) combine(1)
SEE ALSO
cmp(1), combine2(1), comm(1), diff(1), diff3(1)
DIAGNOSTICS
Exit status is 0 for files identical, 1 for some differ-
ences, 2 for errors.
AUTHOR
Clifford P. Van Dyke
BUGS
Does not allow input file to be specified as - to indicate
stdin.
Does not allow comparison of binary files. Does not always
complain if an input file is a binary file.
Does not check to see if two files have the same inode.
Page 4 CX/UX User's Reference Manual