COMPARE(1L)

NAME
compare - fast binary comparison of two files

SYNOPSIS
compare [ options ] file1 file2

DESCRIPTION
Compare examines one file and standard in, or two files on a byte by byte basis, and prints the file position of the first difference it finds, first in decimal and then in hexadecimal, followed by the differing byte content in hexadecimal and as quoted character.

Compare is similar to the UNIX utility cmp(1) but faster.

The lines count from 1, the byte offset counts from 0. This is a deviation from the UNIX cmp(1) utility, which counts byte offsets beginning from 1.

OPTIONS
Note all options can be abbreviated to their first letter.

-all, -a, -long, -l
    Do not stop comparing the files if the first difference is found.

-lines,-L
    Count lines while comparing data. This slows down the process of comparison by a factor of two. The line count starts after the optional initial skip on a file.
b=#
begin=#
    Start comparing at byte n, otherwise at byte 0.
b1=#
begin1=#
    Start comparing file 1 at byte n, otherwise at byte 0.
b2=#
begin2=#
    Start comparing fle 2 at byte n, otherwise at byte 0.
c=#
count=#
    Stops after comparing n bytes, otherwise if the first files encounters EOF.

-silent
    Does not print messages, just returns the exit code.

-help
    Prints a short summary of the compare options and exists.

-version
    Prints the compare version number string and exists.

NOTES
numbers in the options begin=#, begin1=#, begin2=#, and count=# are assumed to be bytes. However typing the character 'b' after the number means blocks (512 bytes). (E.g. begin=6b count=1000b). Other suffixes may used as for the bs= option in sdd(1) 'k' means 1024 bytes, 'm' means 1024 KBytes.

BUGS