The UNIX and Linux Forums  

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
UNIX; Compare two files abhishek3598 UNIX for Advanced & Expert Users 1 11-06-2007 06:52 PM
Help! Suggestions on what I can I use my 2 unix boxes for? JimmyChang UNIX for Dummies Questions & Answers 3 09-16-2007 01:55 PM
How to direct-connect two UNIX boxes agcodba UNIX for Advanced & Expert Users 3 07-20-2007 07:23 PM
What can I ignore when backing up UNIX boxes? geralex UNIX for Dummies Questions & Answers 4 09-19-2005 04:22 AM
text boxes, radio buttons , check boxes in c++ on unix devy8 High Level Programming 3 07-07-2001 06:58 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 09-27-2006
flattyre flattyre is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 1
Compare files across 2 UNIX boxes

Is it possible to compare two files which reside on different UNIX boxes?
(I'm using HP POSIX/Korn)

Consider the scenario of a pre-production environment (box 1) and a production environment (box 2) I would like to check if some files on both boxes match or not.

It's quite straightforward on one box:

#----------------------------------------------------
# Function to compares files and display differences
#
# $1 = file1, $2 = file2
#
# cmp with option -s gives the following return codes:
# 0 - identical
# 1 - different
# 2 - inaccessable/other
#----------------------------------------------------
function fn030_compare_file {

cmp -s $1 $2

if [[ $? -gt 0 ]]
then
echo "*** Difference in files! -----> $1 <---> $2"
else
echo "*** OK, Files identical -----> $1 <---> $2"
fi

return
}

The only alternative I can think of is to copy the files to one box, then compare from there.

NOTE: I found an excellent shell script which recursively compares the contents of two directories on one box (to find this do a google search on "cmptree"...)
 

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 05:16 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
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