Hitachi

Job Management Partner 1 Version 10 Job Management Partner 1/Advanced Shell Description, User's Guide, Reference, and Operator's Guide


cmp command (compares binary files)

Organization of this page

Format

cmp [-l|-s] path-name-1 path-name-2 [skip-1 [skip-2]]

Description

This command compares binary files. Differences in byte values and the locations where the differences occur can be displayed.

Arguments

If the -l and -s options are both omitted, the command displays only the location where the first difference is detected. An error results if the -l and -s options are both specified.

-l

Specifies that each set of a difference in byte values (octal) and their offset in bytes (decimal) are to be displayed.

-s

Specifies that only a termination status indicating whether the files are different is to be returned.

path-name-1

Specifies the path name of the comparison source file. If you specify - for path-name-1, the contents for comparison are read from the standard input.

path-name-2

Specifies the path name of the comparison target file. If you specify - for path-name-2, the contents for comparison are read from the standard input.

skip-1

Specifies the position (in bytes) in the file in path-name-1 that is to be the beginning point of the comparison processing.

skip-2

Specifies the position (in bytes) in the file in path-name-2 that is to be the beginning point of the comparison processing.

Return codes

Return code

Meaning

0

Normal termination. The files are identical.

1

Normal termination. The files are different. Or, the end-of-file (EOF) was reached earlier in one file than in the other, in which case a message (cmp: EOF on file-name) is output.

2 or greater

Error termination

Notes

Usage examples

These usage examples illustrate the results of executing the cmp command on the files abc.txt and abcd.txt, whose contents are shown below. In the examples, [Figure] represents a space and [Figure] represents a tab character.

The files listed above are the input files in the following examples, which illustrate the results of executing the cmp command.