<?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 grep to compare two files... in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-to-compare-two-files/m-p/4712731#M659986</link>
    <description>com, comm give issues...so, i am thinking of comparing two files with grep itself...&lt;BR /&gt;&lt;BR /&gt;I am having two list of nodes. i want to compare them and make the list of nodes present in fair and missing in app1&lt;BR /&gt;ie, &lt;BR /&gt;grep $NODE app1-node-list &amp;gt;&amp;gt;present&lt;BR /&gt;if $NODE not present in app1 node list, i want to write it in a new file...how to do that please....&lt;BR /&gt;&lt;BR /&gt;root@fair&amp;gt; ll&lt;BR /&gt;total 224&lt;BR /&gt;-rw-r--r-- 1 root sys 85757 Nov 12 01:47 app1-node-list&lt;BR /&gt;-rw-r--r-- 1 root sys 19198 Nov 12 08:25 fair-node-list&lt;BR /&gt;root@fair&amp;gt;&lt;BR /&gt;root@fair&amp;gt; for NODE in `cat fair-node-list`&lt;BR /&gt;&amp;gt; do&lt;BR /&gt;&amp;gt; grep $NODE app1-node-list &amp;gt;&amp;gt;present&lt;BR /&gt;&amp;gt; done&lt;BR /&gt;root@fair&amp;gt; ll&lt;BR /&gt;total 256&lt;BR /&gt;-rw-r--r-- 1 root sys 85757 Nov 12 01:47 app1-node-list&lt;BR /&gt;-rw-r--r-- 1 root sys 19198 Nov 12 08:25 fair-node-list&lt;BR /&gt;-rw-r--r-- 1 root sys 14017 Nov 12 09:28 present&lt;BR /&gt;root@fair&amp;gt; wc *&lt;BR /&gt;7637 7660 85757 app1-node-list&lt;BR /&gt;1576 1570 19198 fair-node-list&lt;BR /&gt;1192 1192 14017 present&lt;BR /&gt;10405 10422 118972 total&lt;BR /&gt;root@fair&amp;gt;</description>
    <pubDate>Fri, 12 Nov 2010 15:07:39 GMT</pubDate>
    <dc:creator>sekar sundaram</dc:creator>
    <dc:date>2010-11-12T15:07:39Z</dc:date>
    <item>
      <title>grep to compare two files...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-to-compare-two-files/m-p/4712731#M659986</link>
      <description>com, comm give issues...so, i am thinking of comparing two files with grep itself...&lt;BR /&gt;&lt;BR /&gt;I am having two list of nodes. i want to compare them and make the list of nodes present in fair and missing in app1&lt;BR /&gt;ie, &lt;BR /&gt;grep $NODE app1-node-list &amp;gt;&amp;gt;present&lt;BR /&gt;if $NODE not present in app1 node list, i want to write it in a new file...how to do that please....&lt;BR /&gt;&lt;BR /&gt;root@fair&amp;gt; ll&lt;BR /&gt;total 224&lt;BR /&gt;-rw-r--r-- 1 root sys 85757 Nov 12 01:47 app1-node-list&lt;BR /&gt;-rw-r--r-- 1 root sys 19198 Nov 12 08:25 fair-node-list&lt;BR /&gt;root@fair&amp;gt;&lt;BR /&gt;root@fair&amp;gt; for NODE in `cat fair-node-list`&lt;BR /&gt;&amp;gt; do&lt;BR /&gt;&amp;gt; grep $NODE app1-node-list &amp;gt;&amp;gt;present&lt;BR /&gt;&amp;gt; done&lt;BR /&gt;root@fair&amp;gt; ll&lt;BR /&gt;total 256&lt;BR /&gt;-rw-r--r-- 1 root sys 85757 Nov 12 01:47 app1-node-list&lt;BR /&gt;-rw-r--r-- 1 root sys 19198 Nov 12 08:25 fair-node-list&lt;BR /&gt;-rw-r--r-- 1 root sys 14017 Nov 12 09:28 present&lt;BR /&gt;root@fair&amp;gt; wc *&lt;BR /&gt;7637 7660 85757 app1-node-list&lt;BR /&gt;1576 1570 19198 fair-node-list&lt;BR /&gt;1192 1192 14017 present&lt;BR /&gt;10405 10422 118972 total&lt;BR /&gt;root@fair&amp;gt;</description>
      <pubDate>Fri, 12 Nov 2010 15:07:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-to-compare-two-files/m-p/4712731#M659986</guid>
      <dc:creator>sekar sundaram</dc:creator>
      <dc:date>2010-11-12T15:07:39Z</dc:date>
    </item>
    <item>
      <title>Re: grep to compare two files...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-to-compare-two-files/m-p/4712732#M659987</link>
      <description>well, you could just use : &lt;BR /&gt;&lt;BR /&gt;   grep -f app1-node-list fair-node-list&lt;BR /&gt;&lt;BR /&gt;Beware that the lines in the first file mentioned are treated as regular expression PATTERNs. &lt;BR /&gt;So depending on needs, feeds and the exact platform being used you may want to add any or all of:&lt;BR /&gt;  -i, ignore case distinctions&lt;BR /&gt;  -w, force PATTERN to match only whole words&lt;BR /&gt;  -x, force PATTERN to match only whole lines&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 12 Nov 2010 15:33:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-to-compare-two-files/m-p/4712732#M659987</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2010-11-12T15:33:38Z</dc:date>
    </item>
    <item>
      <title>Re: grep to compare two files...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-to-compare-two-files/m-p/4712733#M659988</link>
      <description>looks like something wrong...&lt;BR /&gt;&lt;BR /&gt; grep -f app1-node-list fairlane-node-list |wc&lt;BR /&gt;1576 1570 19198&lt;BR /&gt;</description>
      <pubDate>Fri, 12 Nov 2010 16:27:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-to-compare-two-files/m-p/4712733#M659988</guid>
      <dc:creator>sekar sundaram</dc:creator>
      <dc:date>2010-11-12T16:27:26Z</dc:date>
    </item>
    <item>
      <title>Re: grep to compare two files...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-to-compare-two-files/m-p/4712734#M659989</link>
      <description>&lt;BR /&gt;I missed out the NOT, for grep that is: -v&lt;BR /&gt;&lt;BR /&gt;It this what you desire:&lt;BR /&gt;&lt;BR /&gt;# cat fair-node-list&lt;BR /&gt;aap&lt;BR /&gt;noot&lt;BR /&gt;kees&lt;BR /&gt;# cat app1-node-list&lt;BR /&gt;aap&lt;BR /&gt;noot&lt;BR /&gt;mies&lt;BR /&gt;vuur&lt;BR /&gt;# grep -v -f app1-node-list fair-node-list&lt;BR /&gt;kees&lt;BR /&gt;#&lt;BR /&gt;</description>
      <pubDate>Fri, 12 Nov 2010 16:55:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-to-compare-two-files/m-p/4712734#M659989</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2010-11-12T16:55:24Z</dc:date>
    </item>
    <item>
      <title>Re: grep to compare two files...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-to-compare-two-files/m-p/4712735#M659990</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Using 'comm' assumes sorted files.  Using Hein's files and their contents:&lt;BR /&gt;&lt;BR /&gt;# comm -13  app1-node-list fair-node-list&lt;BR /&gt;kees&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Fri, 12 Nov 2010 17:08:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-to-compare-two-files/m-p/4712735#M659990</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-11-12T17:08:39Z</dc:date>
    </item>
    <item>
      <title>Re: grep to compare two files...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-to-compare-two-files/m-p/4712736#M659991</link>
      <description>Hi, can you tell me this issue -- &lt;BR /&gt;&lt;BR /&gt;#if $NODE is present in node.list, update that to present.txt&lt;BR /&gt;grep $NODE node.list &amp;gt;&amp;gt;present.txt&lt;BR /&gt;#if $NODE is not present in this node.list, how to check that condition? will this below if loop will work?&lt;BR /&gt;if [ `grep $NODE node.list` ==0 ]&lt;BR /&gt;then &lt;BR /&gt;echo $NODE &amp;gt;&amp;gt;not.present.txt&lt;BR /&gt;fi</description>
      <pubDate>Sun, 14 Nov 2010 06:24:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-to-compare-two-files/m-p/4712736#M659991</guid>
      <dc:creator>sekar sundaram</dc:creator>
      <dc:date>2010-11-14T06:24:54Z</dc:date>
    </item>
    <item>
      <title>Re: grep to compare two files...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-to-compare-two-files/m-p/4712737#M659992</link>
      <description>&lt;!--!*#--&gt;&amp;gt;will this below "if" work?&lt;BR /&gt;&lt;BR /&gt;You need to clean it up a little:&lt;BR /&gt;grep -q $NODE node.list&lt;BR /&gt;if [ $? -ne 0 ]; then&lt;BR /&gt;   echo $NODE &amp;gt;&amp;gt; not.present.txt&lt;BR /&gt;fi</description>
      <pubDate>Sun, 14 Nov 2010 10:48:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-to-compare-two-files/m-p/4712737#M659992</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2010-11-14T10:48:34Z</dc:date>
    </item>
  </channel>
</rss>

