<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Comparing more than two files in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/comparing-more-than-two-files/m-p/3412751#M202818</link>
    <description>Here is a perl script to checksum each file on each host and print out which files are the same on each host.&lt;BR /&gt; &lt;BR /&gt;Each file is pulled to /tmp. The checksum is done after the file has been simplified (ignore blank lines, ignore comments, squeeze multiple blanks, etc).&lt;BR /&gt; &lt;BR /&gt;The print out will list each file followed by the hosts that have the same checksums.&lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;-- Rod Hills&lt;BR /&gt; &lt;BR /&gt;@hosts=qw{server1 server2 server3};&lt;BR /&gt;@files=qw{/etc/services /etc/sendmail.cf /etc/nsswitch.conf /etc/profile /root/.forward /etc/shells sudoers syslog.conf /root/.profile};&lt;BR /&gt;foreach $host (@hosts) {&lt;BR /&gt;foreach $file (@files) {&lt;BR /&gt; system("scp -q $host:$file /tmp/file1");&lt;BR /&gt; $cksum=0;&lt;BR /&gt; open(INP," while(&lt;INP&gt;) {&lt;BR /&gt;  chomp;&lt;BR /&gt;  next if /^$/;     # Skip blank lines&lt;BR /&gt;  next if /^#/;     # Skip comments&lt;BR /&gt;  s/\s+/ /g;        # Squeeze multiple blanks&lt;BR /&gt;  y/A-Z/a-z/;       # make line all lowercase&lt;BR /&gt;  $cksum+=unpack("%32a*",$_);&lt;BR /&gt; }&lt;BR /&gt; push(@{%hold{$file}{$cksum}},$host);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;foreach $file (sort keys %hold) {&lt;BR /&gt; print $file,"\n";&lt;BR /&gt; foreach $cksum (keys %{$hold{$file}}) {&lt;BR /&gt;  print "  Match:";&lt;BR /&gt;  foreach $host (sort @{$hold{$file}{$cksum}}) {&lt;BR /&gt;   print " ",$host;&lt;BR /&gt;  }&lt;BR /&gt;  print "\n";&lt;BR /&gt; }&lt;BR /&gt;}&lt;/INP&gt;</description>
    <pubDate>Tue, 02 Nov 2004 10:43:35 GMT</pubDate>
    <dc:creator>Rodney Hills</dc:creator>
    <dc:date>2004-11-02T10:43:35Z</dc:date>
    <item>
      <title>Comparing more than two files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/comparing-more-than-two-files/m-p/3412746#M202813</link>
      <description>Hi All&lt;BR /&gt;&lt;BR /&gt;Can anybody help me in compareing &lt;BR /&gt;services &lt;BR /&gt;sendmail.cf &lt;BR /&gt;nsswitch.conf &lt;BR /&gt;/etc/profile &lt;BR /&gt;/root/.forward &lt;BR /&gt;/etc/shells &lt;BR /&gt;sudoers &lt;BR /&gt;syslog.conf &lt;BR /&gt;/root/.profile &lt;BR /&gt;&lt;BR /&gt;these files in more than 80 servers &lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Binu</description>
      <pubDate>Tue, 02 Nov 2004 09:02:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/comparing-more-than-two-files/m-p/3412746#M202813</guid>
      <dc:creator>Party</dc:creator>
      <dc:date>2004-11-02T09:02:58Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing more than two files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/comparing-more-than-two-files/m-p/3412747#M202814</link>
      <description>Hi Binu,&lt;BR /&gt;&lt;BR /&gt;Do you want to compare each of them against a model / baseline &lt;BR /&gt;or do you want to compare against each of them.&lt;BR /&gt;In the later, what would you do with the results ?&lt;BR /&gt;&lt;BR /&gt;Jean-Luc</description>
      <pubDate>Tue, 02 Nov 2004 09:09:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/comparing-more-than-two-files/m-p/3412747#M202814</guid>
      <dc:creator>Jean-Luc Oudart</dc:creator>
      <dc:date>2004-11-02T09:09:42Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing more than two files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/comparing-more-than-two-files/m-p/3412748#M202815</link>
      <description>Hi Jean&lt;BR /&gt;&lt;BR /&gt;My requirement is to check whether the above &lt;BR /&gt;files are similar  in 80 diffrent servers&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Binu</description>
      <pubDate>Tue, 02 Nov 2004 09:25:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/comparing-more-than-two-files/m-p/3412748#M202815</guid>
      <dc:creator>Party</dc:creator>
      <dc:date>2004-11-02T09:25:16Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing more than two files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/comparing-more-than-two-files/m-p/3412749#M202816</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;ok you want to check all of them against all others...&lt;BR /&gt;&lt;BR /&gt;I think this will involve a fair amount of scripting.&lt;BR /&gt;Once you have the script right for one (say /etc/services), you can extent to other files.&lt;BR /&gt;&lt;BR /&gt;You will have to copy all the files (qualified with hostname) in a central location, then run the compare script.&lt;BR /&gt;&lt;BR /&gt;Also, you will have to make some choice&lt;BR /&gt;e.g&lt;BR /&gt;- ignore comment lines&lt;BR /&gt;- ignore blank lines&lt;BR /&gt;- Is the order important ? (the files may be different eventhough contents is the same !), if not re-order te file prior to comparison, ...&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Jean-Luc</description>
      <pubDate>Tue, 02 Nov 2004 09:42:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/comparing-more-than-two-files/m-p/3412749#M202816</guid>
      <dc:creator>Jean-Luc Oudart</dc:creator>
      <dc:date>2004-11-02T09:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing more than two files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/comparing-more-than-two-files/m-p/3412750#M202817</link>
      <description>We can compare two same files with diff command.&lt;BR /&gt;&lt;BR /&gt;If you want to compare each line of unique files from 80 server then, scripting needed here.&lt;BR /&gt;&lt;BR /&gt;diff -Nur &lt;FILE1&gt; &lt;FILE2&gt; will give difference there.&lt;BR /&gt;&lt;BR /&gt;&lt;/FILE2&gt;&lt;/FILE1&gt;</description>
      <pubDate>Tue, 02 Nov 2004 09:43:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/comparing-more-than-two-files/m-p/3412750#M202817</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2004-11-02T09:43:50Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing more than two files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/comparing-more-than-two-files/m-p/3412751#M202818</link>
      <description>Here is a perl script to checksum each file on each host and print out which files are the same on each host.&lt;BR /&gt; &lt;BR /&gt;Each file is pulled to /tmp. The checksum is done after the file has been simplified (ignore blank lines, ignore comments, squeeze multiple blanks, etc).&lt;BR /&gt; &lt;BR /&gt;The print out will list each file followed by the hosts that have the same checksums.&lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;-- Rod Hills&lt;BR /&gt; &lt;BR /&gt;@hosts=qw{server1 server2 server3};&lt;BR /&gt;@files=qw{/etc/services /etc/sendmail.cf /etc/nsswitch.conf /etc/profile /root/.forward /etc/shells sudoers syslog.conf /root/.profile};&lt;BR /&gt;foreach $host (@hosts) {&lt;BR /&gt;foreach $file (@files) {&lt;BR /&gt; system("scp -q $host:$file /tmp/file1");&lt;BR /&gt; $cksum=0;&lt;BR /&gt; open(INP," while(&lt;INP&gt;) {&lt;BR /&gt;  chomp;&lt;BR /&gt;  next if /^$/;     # Skip blank lines&lt;BR /&gt;  next if /^#/;     # Skip comments&lt;BR /&gt;  s/\s+/ /g;        # Squeeze multiple blanks&lt;BR /&gt;  y/A-Z/a-z/;       # make line all lowercase&lt;BR /&gt;  $cksum+=unpack("%32a*",$_);&lt;BR /&gt; }&lt;BR /&gt; push(@{%hold{$file}{$cksum}},$host);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;foreach $file (sort keys %hold) {&lt;BR /&gt; print $file,"\n";&lt;BR /&gt; foreach $cksum (keys %{$hold{$file}}) {&lt;BR /&gt;  print "  Match:";&lt;BR /&gt;  foreach $host (sort @{$hold{$file}{$cksum}}) {&lt;BR /&gt;   print " ",$host;&lt;BR /&gt;  }&lt;BR /&gt;  print "\n";&lt;BR /&gt; }&lt;BR /&gt;}&lt;/INP&gt;</description>
      <pubDate>Tue, 02 Nov 2004 10:43:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/comparing-more-than-two-files/m-p/3412751#M202818</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2004-11-02T10:43:35Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing more than two files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/comparing-more-than-two-files/m-p/3412752#M202819</link>
      <description>Hi&lt;BR /&gt;Thank you very much for your valueable input &lt;BR /&gt;Can you help me in clarifying some more doubts&lt;BR /&gt;1)Can  we find out which lines in the files have diffrences &lt;BR /&gt;2)Do we have to ftp individual files in a single server  for comaprison if not how the authentication happens&lt;BR /&gt;3)Can we excecute the script  from a single server which collects the files  from all the servers and gives the comparison output&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Binu</description>
      <pubDate>Tue, 02 Nov 2004 11:05:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/comparing-more-than-two-files/m-p/3412752#M202819</guid>
      <dc:creator>Party</dc:creator>
      <dc:date>2004-11-02T11:05:19Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing more than two files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/comparing-more-than-two-files/m-p/3412753#M202820</link>
      <description>In my script above, I am fetching each file from each host. I am not using ftp, but rather "scp" which is part of openssh. Openssh is available from HP software depot. The benefit of scp is that if configured correctly, you don't need to give a password, plus the data is secured as it is transfered over the network.&lt;BR /&gt; &lt;BR /&gt;My script is designed to run from a single host.&lt;BR /&gt; &lt;BR /&gt;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.&lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Tue, 02 Nov 2004 11:28:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/comparing-more-than-two-files/m-p/3412753#M202820</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2004-11-02T11:28:16Z</dc:date>
    </item>
  </channel>
</rss>

