The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
need some help..Comparison bluesilo Shell Programming and Scripting 0 02-23-2008 04:43 PM
Wildcard comparison rdudejr Shell Programming and Scripting 2 08-02-2006 05:09 PM
compiled binary file gives "cannot execute binary file" scgupta SUN Solaris 0 07-13-2006 01:59 AM
dir comparison help ghazi Shell Programming and Scripting 5 12-20-2004 05:54 PM
comparison cnf Filesystems, Disks and Memory 2 05-14-2002 01:52 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-18-2003
indigoecho indigoecho is offline
Registered User
  
 

Join Date: Dec 2003
Posts: 4
Binary Comparison

Hi guys,

I need to write a script that will list all the files in the current diretory which are identical to a filename that the user enters using binary comparison, but I'm not entirely sure how to go about it. It's part of a larger script of system administration tools but I just can't find anything about binary comparison that's helpful.

Any advice appreciated!
  #2 (permalink)  
Old 12-18-2003
jsilva's Avatar
jsilva jsilva is offline
Registered User
  
 

Join Date: Apr 2003
Posts: 169
Hi,

You should use md5 ( http://www.fourmilab.ch/md5/ ) to do binary comparison...
  #3 (permalink)  
Old 12-18-2003
Ygor's Avatar
Ygor Ygor is offline Forum Staff  
Moderator
  
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,402
I would use cmp -s to compare files and check the return code.
  #4 (permalink)  
Old 12-18-2003
kduffin's Avatar
kduffin kduffin is offline Forum Advisor  
UN1X
  
 

Join Date: Nov 2003
Location: Maryland
Posts: 449
diff will also return for binary files, ergo:

$ diff /usr/bin/ls /usr/bin/df
Binary files /usr/bin/ls and /usr/bin/df differ
$ echo $?
2

$ diff /usr/bin/ls /usr/bin/ls
$ echo $?
0
$

Cheers, Keith
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 10:25 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0