Sponsored Content
Top Forums Shell Programming and Scripting Compare files across 2 UNIX boxes Post 302090747 by flattyre on Wednesday 27th of September 2006 09:30:30 AM
Old 09-27-2006
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) Smilie

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"...)
 

10 More Discussions You Might Find Interesting

1. Programming

text boxes, radio buttons , check boxes in c++ on unix

Hi ! Please tell me how to get radio buttons, text boxes , check boxes , option buttons , pull down menus in C++ on Unix. I think it would be done using curses.h ..but that's all i know. TIA, Devyani. (3 Replies)
Discussion started by: devy8
3 Replies

2. UNIX for Dummies Questions & Answers

Help! Suggestions on what I can I use my 2 unix boxes for?

Once upon a looong time ago I used to work with Unix systems - SGI mainly. Now I've inherited 2 boxes - an SGI dual processor Octane and an Indigo2. For the past 2 years they've sat waiting for me to do something with them and never getting round to it. I run a windows network at home so... (3 Replies)
Discussion started by: JimmyChang
3 Replies

3. UNIX for Advanced & Expert Users

UNIX; Compare two files

Hi Guys, Requirement: Want to compare two files, if the the content of both files is same then show "Good result" else Show "Bad Result" I am using the following logic if( cmp -s a b = 0 ) then echo "Good result" else echo "Bad result" exit 0 fi But this is... (1 Reply)
Discussion started by: abhishek3598
1 Replies

4. UNIX for Dummies Questions & Answers

Unix Compare Files

Hi, I need to compare 2 files based on the first field in each file and output the differences to a new file. example File 1 and File 2 both have first field as Number ie: File 1 1252652355 1859553322 1778899562 File 2 1252652355 1859553322 So I would expect File 3 to... (2 Replies)
Discussion started by: Lagre1
2 Replies

5. UNIX for Dummies Questions & Answers

how can i unix compare two files??

how can i unix compare two files?? var1 = 6499 7328 6351 7583 7573 var2 = 6499 7328 6351 7583 7777 i did: diff $var1 $var2 and i got the output: 1c1 < 6499 7328 6351 7583 7573 --- > 6499 7328 6351 7583 7777 what can i do with it? and what does it tell me?? how can i knoe that... (2 Replies)
Discussion started by: nirnir26
2 Replies

6. UNIX for Advanced & Expert Users

How to compare two files using UNIX?

I have two files which have primary key(s) for each row. I need to compare both the files and produce the output in the following format. Primary key(s),file1 value,file2 value. Both the input files will be comma separated files. I have accomplished this using perl, but it is... (6 Replies)
Discussion started by: gpsridhar
6 Replies

7. UNIX for Dummies Questions & Answers

problem to determine all files and dir match up on 2 different unix boxes

Hi Friends I have 2 solaris boxes and I need to check certain directories (on local filesystem and mounted nfs) to make sure that they match up on both boxes and to delete or move the other mismatches to elsewhere on the local filesystem. I investigated for unix commands like rsync, and tree... (1 Reply)
Discussion started by: mpc8250
1 Replies

8. Shell Programming and Scripting

Compare two files in unix

Hi Gurus I need your kind help sorting the below query I have two text files File1.txt ID Name Address 101 Srinath BBB 102 Sidharth CCC File2.txt ID Name Address 102 Siddharth DDD 103 Suman EEE Now the requirement is if the second file has... (0 Replies)
Discussion started by: Pratik4891
0 Replies

9. Shell Programming and Scripting

Compare two files in UNIX

Hi, I have two files File1 Contents: abc dcf sdc File2 Contents: dcf sdc erg Now my program should return the contents existing in File1 but not in File2. In this case output shoud be "abc" as abc is not available in File 2. It should not return "erg" by saying it is... (4 Replies)
Discussion started by: forums123456
4 Replies

10. Shell Programming and Scripting

Compare two files in UNIX

I have requirement to compare two files in unix. Below are the sample files. File1: cn=test123,cn=bobgroup,dc=ind,dc=com cn=bob123,cn=bobgroup,dc=ind,dc=com cn=test13,cn=bobgroup,dc=ind,dc=com cn=est12,cn=bobgroup,dc=ind,dc=com cn=st123,cn=bobgroup,dc=ind,dc=com File2... (1 Reply)
Discussion started by: babu92
1 Replies
GENBOX(1)						      General Commands Manual							 GENBOX(1)

NAME
genrbox - generate a RADIANCE description of a box SYNOPSIS
genrbox mat name xsiz ysiz zsiz [ -i ][ -r rad | -b bev ] DESCRIPTION
Genbox produces a RADIANCE scene description of a parallelepiped with one corner at the origin and the opposite corner at (xsiz, ysiz, zsiz). The sides of the box will be parallel to the three coordinate planes. The surfaces that make up the box will be modified by mat and their identifiers will begin with name. The -i option can be used to produce a box with inward directed surface normals. The -r option can be used to specify the radius for rounded edges. The -b option can be used to specify the indentation for beveled edges. EXAMPLE
To produce a rectangular box made of wood with beveled edges: genrbox wood box1 5 8 3 -b .5 > box1 AUTHOR
Greg Ward BUGS
Because spheres and cylinders are used to construct boxes with rounded edges, a transparent box of this type appears quite messy. SEE ALSO
genrev(1), gensurf(1), genworm(1), rpict(1), rvu(1), xform(1) RADIANCE
11/15/93 GENBOX(1)
All times are GMT -4. The time now is 11:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy