Click to See Complete Forum and Search --> : Comparing os install


Nightkap
07-02-2007, 02:13 PM
I am trying to compare RHEL and CentOS's default installed packages. I understand they're supposed to be identical but there are differences in package versions and excluded packages that can't be ported over to Cent (namely RHN-tools and the like)

here my situation:

On both linux systems I grabbed a list of all installed packages and dumped them into a file.

Red Hat Enterprise Linux 4 (default install)

$ rpm -qa > rhel.installed.pkgs

Centos 4.4 (default install)

$ rpm -qa > centos.installed.pkgs

I then used the “diff” command to compare the 2 files against each other and pipe the results through the word count program with the -l switch to display the number of lines in the file, the results where not what I had expected.

$ diff rhel.installed.pkgs centos.insalled.pkgs | wc -l
881

Clearly there are not 881 different packages installed. The diff command compares line by line so if the order is off this will not report what I'm looking for. So I did a sort on both files and tried again (728 lines) but of course as soon as it sees any inconsistencies it will again report data I'm looking for incorrectly.

it there an easy way of comparing 2 files against each other and writing the unmatched results to a file???

Thanks for any help,

hotcold
07-02-2007, 05:50 PM
Hi.

Utility comm compares sorted files and displays 3 columns for the 3 conditions, unique to file1, unique to file2, and in both. See man comm for details.

However, in looking quickly at rpm lists for RHEL4/U4, and CentOS 4.4, there appear to be differences in the names, such as minor versions, etc. Print a list of the sorted first 60 or so with paste, and you'll be able to spot the differences visually.

How important those suffixes are to you will have an effect on the comparison, and (presumably) on the script you create to process those details ... cheers, hotcold