Re: binary diff command

From: Marko Mäkelä (msmakela_at_cc.hut.fi)
Date: 2000-02-07 16:08:57

On Mon, 7 Feb 2000, Richard Atkinson wrote:

> I'm sure this topic has come up before, but I don't recall the outcome -
> is there any way under Unix to do a binary compare of two files? Something
> like diff but operating on arbitrary binary files rather than text.

Pipe the files through "od -Ax -t x1" and compare the output of the two
dumps.  I think Emacs diff (M-x ediff-buffers) is the best comparison
tool; unfortunately it doesn't work in hexl-mode (the hexadecimal editing
mode for Emacs).

Another good dumping tool is the hexdump command shipped with some Linux
distributions.  I use it with the following alias:

alias dump='hexdump -e '"'"'"%05.5_ax: " 16/1 "%02x "'"'"' -e '"'"'" : " 16/1 "%_p" "\n"'"'"

Aren't those sequences of single and double quotes nice? :-)  There
probably is a shorter way to escape quotes, but I didn't want to use
backslashes at that time.

	Marko

PS: I've never heard of a "hex" command; it's not part of POSIX.2
(ISO/IEC 9945-2:1993).  It's probably an alias.

-
This message was sent through the cbm-hackers mailing list.
To unsubscribe: echo unsubscribe | mail cbm-hackers-request@dot.tcm.hut.fi.

Archive generated by hypermail 2.1.1.