[Top] [Prev] [Next]


cmp - compare files


cmp [-Ll] file1 file2 [offset1] [offset2]


The cmp command byte-wise compares the contents of files file1 and file2 starting at offsets offset1 and offset2 (default 0).

If there are no differences, the command produces no output. If a difference is detected, a message is generated to standard output reporting the location of the first different character in the format shown below:

	file1 file2 differ: char xxx 

where xxx is in decimal format.


Add the line number to the difference message:

file1 file2 differ: char xxx line yy

where yy is in decimal format.


Starting at the first difference detected, print a line for each subsequent byte.

Each line consists of the byte number (decimal) and the corresponding byte values (hexadecimal) from each file.

If one file is shorter, there is an additional line stating on which file the EOF was encountered.


Though the output line speaks of char differences, the comparison is, in fact, byte-oriented.

[Top] [Prev] [Next]

Copyright © 1996,Lucent Technologies, Inc. All rights reserved.