• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 840
  • Last Modified:

How To Compare File Contents of Two Files Residing On Different Hosts

What is the most efficient way to compare the contents of two files residing on two different hosts? I need something I can build into a script.

HP-UX has a great utility for doing this, but I've not found an analog in Solaris 8.

  • 3
  • 2
1 Solution
diff/sdiff  : if u want to compare 2 text file( this may be code or simple text files).
cksum: write file checksums and sizes, u get cksum for files and can comapre cksums.

if u just want to compare contents of file i would say go with diff.

if u want to use it in script, please check this answer.
i think u are looking for it.

there is one more command on solaris called cmp.
try man cmp.
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

What do you use under HP-UX? I'm not aware of any proprietary utilities for that sort of task....Tho' I'd normally argue that HP kit & HP-UX are superior to Sun/Solaris ;-)

Are you thinking about rdist/rsync?
pdouglasAuthor Commented:

Yes. I believe it was rdist that I used under HP-UX 10.20. It was very useful, provided you're careful. It can bite you if you're not.


Thanks for your input!

And cheers to all! You folks really are top notch.
rdist comes with Solaris (it's pretty standard) and if you've already taken the trouble to learn how to use it safely, all your scripts/knowledge should be portable;  It's quite efficient too - Saving you from having to do a manual compare and _then_ update the file that is out of sync. On the other hand, if you just need a comparison of files visible from a single host (e.g. on local & NFS mounted filesystems), shivsa's suggestions are simpler & safer.

rsync isn't part of the base HP-UX or Solaris, but is available for both and is supposed to be more efficient & secure - though opinion is divided on which is "better"
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now