<?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: Howto merge 2 differrent /etc/hosts files? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/howto-merge-2-differrent-etc-hosts-files/m-p/3116218#M898124</link>
    <description>(my prefrence is)&lt;BR /&gt;&lt;BR /&gt;1. grep "^#" /etc/hosts &amp;gt; newhosts&lt;BR /&gt;2. grep -v "^#" /tmp/hosts /etc/hosts|sort|uniq &amp;gt;&amp;gt; newhosts&lt;BR /&gt;&lt;BR /&gt;3. vi newhosts&lt;BR /&gt;put  localhost below comments.&lt;BR /&gt;put  system below localhost.&lt;BR /&gt;fix problem childern like if host are not duplicate host names and ip address that did compare from the sort uniq.&lt;BR /&gt;4. cp /etc/hosts /etc/hosts.rl&lt;BR /&gt;5. cp newhosts /etc/hosts&lt;BR /&gt;&lt;BR /&gt;Rory</description>
    <pubDate>Wed, 12 Nov 2003 13:56:35 GMT</pubDate>
    <dc:creator>Rory R Hammond</dc:creator>
    <dc:date>2003-11-12T13:56:35Z</dc:date>
    <item>
      <title>Howto merge 2 differrent /etc/hosts files?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/howto-merge-2-differrent-etc-hosts-files/m-p/3116209#M898115</link>
      <description>Hi everyone,&lt;BR /&gt;I want to merge the /etc/hosts files caoming from 2 different hosts.&lt;BR /&gt;How I can do it?&lt;BR /&gt;&lt;BR /&gt;Regards...&lt;BR /&gt;PSS</description>
      <pubDate>Tue, 11 Nov 2003 11:29:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/howto-merge-2-differrent-etc-hosts-files/m-p/3116209#M898115</guid>
      <dc:creator>PSS SYS ADMIN</dc:creator>
      <dc:date>2003-11-11T11:29:01Z</dc:date>
    </item>
    <item>
      <title>Re: Howto merge 2 differrent /etc/hosts files?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/howto-merge-2-differrent-etc-hosts-files/m-p/3116210#M898116</link>
      <description>PSS,&lt;BR /&gt;&lt;BR /&gt;Have a look at the sort man page, particularly the merge section.  That should get you started.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Tue, 11 Nov 2003 11:30:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/howto-merge-2-differrent-etc-hosts-files/m-p/3116210#M898116</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2003-11-11T11:30:54Z</dc:date>
    </item>
    <item>
      <title>Re: Howto merge 2 differrent /etc/hosts files?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/howto-merge-2-differrent-etc-hosts-files/m-p/3116211#M898117</link>
      <description>In a third file:&lt;BR /&gt;&lt;BR /&gt;I'd cp /etc/hosts &amp;gt; temp&lt;BR /&gt;then the second&lt;BR /&gt;&lt;BR /&gt;cp /etc/hosts &amp;gt;&amp;gt; temp&lt;BR /&gt;&lt;BR /&gt;Append mode.&lt;BR /&gt;&lt;BR /&gt;I might try sort, but in the end I'm going to have to go through the files manually and look for conflicts.&lt;BR /&gt;&lt;BR /&gt;For sure, get rid of the second loopback line.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Tue, 11 Nov 2003 11:35:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/howto-merge-2-differrent-etc-hosts-files/m-p/3116211#M898117</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2003-11-11T11:35:35Z</dc:date>
    </item>
    <item>
      <title>Re: Howto merge 2 differrent /etc/hosts files?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/howto-merge-2-differrent-etc-hosts-files/m-p/3116212#M898118</link>
      <description>cat hostfile1 hostfile2 &amp;gt;newhostfile.&lt;BR /&gt;&lt;BR /&gt;-USA..</description>
      <pubDate>Tue, 11 Nov 2003 11:38:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/howto-merge-2-differrent-etc-hosts-files/m-p/3116212#M898118</guid>
      <dc:creator>Uday_S_Ankolekar</dc:creator>
      <dc:date>2003-11-11T11:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: Howto merge 2 differrent /etc/hosts files?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/howto-merge-2-differrent-etc-hosts-files/m-p/3116213#M898119</link>
      <description>I would try this:&lt;BR /&gt;&lt;BR /&gt; - get both host files on the same system. Call them host1 and host2&lt;BR /&gt;&lt;BR /&gt; - merge them like this:&lt;BR /&gt;&lt;BR /&gt;cat host1&amp;gt; tmphost&lt;BR /&gt;cat host2&amp;gt;&amp;gt; tmphost&lt;BR /&gt;&lt;BR /&gt; - visually verify the merge:&lt;BR /&gt;&lt;BR /&gt;pg tmphost&lt;BR /&gt;&lt;BR /&gt; - filter the merged file:&lt;BR /&gt;&lt;BR /&gt;cat tmphost|sort|uniq &amp;gt;tmp2host&lt;BR /&gt;&lt;BR /&gt; - visually verify the new file:&lt;BR /&gt;&lt;BR /&gt;pg tmp2host&lt;BR /&gt;&lt;BR /&gt;Now it should be a simple job of removing any remaining duplicates using vi.  When done you can copy the file to /etc/hosts and HUP the appropriate services or reboot.&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;mark</description>
      <pubDate>Tue, 11 Nov 2003 11:39:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/howto-merge-2-differrent-etc-hosts-files/m-p/3116213#M898119</guid>
      <dc:creator>Mark Greene_1</dc:creator>
      <dc:date>2003-11-11T11:39:35Z</dc:date>
    </item>
    <item>
      <title>Re: Howto merge 2 differrent /etc/hosts files?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/howto-merge-2-differrent-etc-hosts-files/m-p/3116214#M898120</link>
      <description>I would cat the 2 files together into 1 file;&lt;BR /&gt;&lt;BR /&gt;cat /etc/hosts &amp;gt;/tmp/newhosts&lt;BR /&gt;cat &lt;HOSTS2&gt; &amp;gt;&amp;gt;/tmp/newhosts&lt;BR /&gt;&lt;BR /&gt;then;&lt;BR /&gt;&lt;BR /&gt;cat /tmp/newhosts | sort -u &amp;gt; /etc/hosts&lt;BR /&gt;&lt;BR /&gt;(Make a backup of /etc/hosts first just in case). The sort -u means remove all duplicates. Then check the hostname for your server has the correct IP in your new hosts file and that should do it.&lt;BR /&gt;&lt;BR /&gt;&lt;/HOSTS2&gt;</description>
      <pubDate>Tue, 11 Nov 2003 11:40:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/howto-merge-2-differrent-etc-hosts-files/m-p/3116214#M898120</guid>
      <dc:creator>Stefan Farrelly</dc:creator>
      <dc:date>2003-11-11T11:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: Howto merge 2 differrent /etc/hosts files?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/howto-merge-2-differrent-etc-hosts-files/m-p/3116215#M898121</link>
      <description>I'd do the cat file1 file2 &amp;gt;&amp;gt; file3&lt;BR /&gt;&lt;BR /&gt;Don't worry too much about the possible duplicates, but be aware that only the 1st one will be read. Also, a small performance gain is possible if you have the most often used entries at the top.</description>
      <pubDate>Tue, 11 Nov 2003 11:45:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/howto-merge-2-differrent-etc-hosts-files/m-p/3116215#M898121</guid>
      <dc:creator>doug mielke</dc:creator>
      <dc:date>2003-11-11T11:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: Howto merge 2 differrent /etc/hosts files?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/howto-merge-2-differrent-etc-hosts-files/m-p/3116216#M898122</link>
      <description>PSS --&lt;BR /&gt;&lt;BR /&gt;I'm assuming you want to remove duplicate items from the two files.&lt;BR /&gt;&lt;BR /&gt;Part of it depends on if you want to preserve comments beyond the top of the files.&lt;BR /&gt;&lt;BR /&gt;If you dont then you can run the attached script as follows:&lt;BR /&gt;&lt;BR /&gt;combine input1 input2 output&lt;BR /&gt;&lt;BR /&gt;It will keep the comments from the top of the FIRST input file specified.  The final assumption is that you dont have files that start with ".useme" in the directory where you are running the script.&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;&lt;BR /&gt;Kent M. Ostby&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 11 Nov 2003 11:45:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/howto-merge-2-differrent-etc-hosts-files/m-p/3116216#M898122</guid>
      <dc:creator>Kent Ostby</dc:creator>
      <dc:date>2003-11-11T11:45:51Z</dc:date>
    </item>
    <item>
      <title>Re: Howto merge 2 differrent /etc/hosts files?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/howto-merge-2-differrent-etc-hosts-files/m-p/3116217#M898123</link>
      <description>You could use perl to merge and remove duplicates.&lt;BR /&gt; &lt;BR /&gt;while(&amp;lt;&amp;gt;) {&lt;BR /&gt; next if /^#/ or /^$/;&lt;BR /&gt; @a=split('\s+',$_);&lt;BR /&gt; $hold{$a[0]}{$a[$i]}=1 for $i (1..$#a);&lt;BR /&gt;}&lt;BR /&gt;foreach $ip (sort keys %hold) {&lt;BR /&gt; print "$ip\t",join(" ",keys %{$hold{$ip}}),"\n";&lt;BR /&gt;}&lt;BR /&gt; &lt;BR /&gt;perl aboveprogram hostfile1 hostfile2 &amp;gt;newhostfile&lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;-- Rod Hills&lt;BR /&gt;</description>
      <pubDate>Tue, 11 Nov 2003 14:49:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/howto-merge-2-differrent-etc-hosts-files/m-p/3116217#M898123</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2003-11-11T14:49:30Z</dc:date>
    </item>
    <item>
      <title>Re: Howto merge 2 differrent /etc/hosts files?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/howto-merge-2-differrent-etc-hosts-files/m-p/3116218#M898124</link>
      <description>(my prefrence is)&lt;BR /&gt;&lt;BR /&gt;1. grep "^#" /etc/hosts &amp;gt; newhosts&lt;BR /&gt;2. grep -v "^#" /tmp/hosts /etc/hosts|sort|uniq &amp;gt;&amp;gt; newhosts&lt;BR /&gt;&lt;BR /&gt;3. vi newhosts&lt;BR /&gt;put  localhost below comments.&lt;BR /&gt;put  system below localhost.&lt;BR /&gt;fix problem childern like if host are not duplicate host names and ip address that did compare from the sort uniq.&lt;BR /&gt;4. cp /etc/hosts /etc/hosts.rl&lt;BR /&gt;5. cp newhosts /etc/hosts&lt;BR /&gt;&lt;BR /&gt;Rory</description>
      <pubDate>Wed, 12 Nov 2003 13:56:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/howto-merge-2-differrent-etc-hosts-files/m-p/3116218#M898124</guid>
      <dc:creator>Rory R Hammond</dc:creator>
      <dc:date>2003-11-12T13:56:35Z</dc:date>
    </item>
  </channel>
</rss>

