- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Comparing more than two files
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2004 01:02 AM
11-02-2004 01:02 AM
Can anybody help me in compareing
services
sendmail.cf
nsswitch.conf
/etc/profile
/root/.forward
/etc/shells
sudoers
syslog.conf
/root/.profile
these files in more than 80 servers
Thanks
Binu
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2004 01:09 AM
11-02-2004 01:09 AM
Re: Comparing more than two files
Do you want to compare each of them against a model / baseline
or do you want to compare against each of them.
In the later, what would you do with the results ?
Jean-Luc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2004 01:25 AM
11-02-2004 01:25 AM
Re: Comparing more than two files
My requirement is to check whether the above
files are similar in 80 diffrent servers
Thanks
Binu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2004 01:42 AM
11-02-2004 01:42 AM
Re: Comparing more than two files
ok you want to check all of them against all others...
I think this will involve a fair amount of scripting.
Once you have the script right for one (say /etc/services), you can extent to other files.
You will have to copy all the files (qualified with hostname) in a central location, then run the compare script.
Also, you will have to make some choice
e.g
- ignore comment lines
- ignore blank lines
- Is the order important ? (the files may be different eventhough contents is the same !), if not re-order te file prior to comparison, ...
Regards
Jean-Luc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2004 01:43 AM
11-02-2004 01:43 AM
Re: Comparing more than two files
If you want to compare each line of unique files from 80 server then, scripting needed here.
diff -Nur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2004 02:43 AM
11-02-2004 02:43 AM
SolutionEach file is pulled to /tmp. The checksum is done after the file has been simplified (ignore blank lines, ignore comments, squeeze multiple blanks, etc).
The print out will list each file followed by the hosts that have the same checksums.
HTH
-- Rod Hills
@hosts=qw{server1 server2 server3};
@files=qw{/etc/services /etc/sendmail.cf /etc/nsswitch.conf /etc/profile /root/.forward /etc/shells sudoers syslog.conf /root/.profile};
foreach $host (@hosts) {
foreach $file (@files) {
system("scp -q $host:$file /tmp/file1");
$cksum=0;
open(INP," while(
chomp;
next if /^$/; # Skip blank lines
next if /^#/; # Skip comments
s/\s+/ /g; # Squeeze multiple blanks
y/A-Z/a-z/; # make line all lowercase
$cksum+=unpack("%32a*",$_);
}
push(@{%hold{$file}{$cksum}},$host);
}
}
foreach $file (sort keys %hold) {
print $file,"\n";
foreach $cksum (keys %{$hold{$file}}) {
print " Match:";
foreach $host (sort @{$hold{$file}{$cksum}}) {
print " ",$host;
}
print "\n";
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2004 03:05 AM
11-02-2004 03:05 AM
Re: Comparing more than two files
Thank you very much for your valueable input
Can you help me in clarifying some more doubts
1)Can we find out which lines in the files have diffrences
2)Do we have to ftp individual files in a single server for comaprison if not how the authentication happens
3)Can we excecute the script from a single server which collects the files from all the servers and gives the comparison output
Thanks
Binu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2004 03:28 AM
11-02-2004 03:28 AM
Re: Comparing more than two files
My script is designed to run from a single host.
My script only indicates which files are the same. To find individual line differences, you would need to define a "base" version of each file and compare against it. My perl script could be modified to do this by stripping out the checksumming and having it call the "diff" command to do the testing.
HTH
-- Rod Hills