Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I compare binary files with UNIX

Status
Not open for further replies.

justcolleen

Programmer
Oct 4, 2000
5
US
Need to find a Unix based command, program or utility to compare two binary files and find out the differnces. The basic Unix commands, cmp, diff, or comm do not work properly with binary files [sig][/sig]
 
What kind of binaries are they Colleen? Are they executables? [sig]<p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br>Making mistakes, so you don't have to. &lt;grin&gt;[/sig]
 
No they are ISAM based datafiles where the data is stored in a binary format. I need to compare an archived file to a current file and only pull the records that are new.

Thanks for the response. [sig]<p>Colleen J. Elash<br><a href=mailto:colleen@infowerks.com>colleen@infowerks.com</a><br>[/sig]
 
Are they rdbms files? [sig]<p>Ged Jones<br><a href=mailto:gedejones@hotmail.com>gedejones@hotmail.com</a><br><a href= > </a><br>Top man[/sig]
 
Why you can't use [tt]cmp[/tt]? This command was designed to compare non text files. Try this:
[tt]
cmp -s first_file second_file ; RCode=$?
if [ $RCode -eq 0 ]
then
echo First file and Second file are the same.
else
if [ $RCode -eq 1 ]
then
echo First and Second file are different!
else
echo An error has ocurred
fi
fi
[/tt]

I hope it works... [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top