<?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: shell script problem.. in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4079592#M735786</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;try this first:&lt;BR /&gt;$ sort fileA &amp;gt;./fileA.s&lt;BR /&gt;$ sort fileB  &amp;gt;./fileB.s&lt;BR /&gt;&lt;BR /&gt;$ comm -23 fileA.s fileB.s&lt;BR /&gt;629000&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.</description>
    <pubDate>Tue, 02 Oct 2007 04:36:27 GMT</pubDate>
    <dc:creator>john korterman</dc:creator>
    <dc:date>2007-10-02T04:36:27Z</dc:date>
    <item>
      <title>shell script problem..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4079589#M735783</link>
      <description>Hello can anyone give fast and good solution on this:&lt;BR /&gt;I have 2 files:&lt;BR /&gt;fileA:&lt;BR /&gt;&lt;BR /&gt;629122&lt;BR /&gt;629145&lt;BR /&gt;629111&lt;BR /&gt;629000&lt;BR /&gt;629999&lt;BR /&gt;629787&lt;BR /&gt;629444&lt;BR /&gt;&lt;BR /&gt;fileB:&lt;BR /&gt;123569&lt;BR /&gt;789999&lt;BR /&gt;629122&lt;BR /&gt;629145&lt;BR /&gt;777777&lt;BR /&gt;629111&lt;BR /&gt;000000&lt;BR /&gt;629999&lt;BR /&gt;629787&lt;BR /&gt;629444&lt;BR /&gt;989898&lt;BR /&gt;777777&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;and result should be :&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;629000&lt;BR /&gt;&lt;BR /&gt;becouse it is the only line that is in fileA and not in fileB&lt;BR /&gt;&lt;BR /&gt;any help..I tryed something with comm..but..no use..</description>
      <pubDate>Tue, 02 Oct 2007 04:25:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4079589#M735783</guid>
      <dc:creator>amonamon</dc:creator>
      <dc:date>2007-10-02T04:25:43Z</dc:date>
    </item>
    <item>
      <title>Re: shell script problem..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4079590#M735784</link>
      <description>hey&lt;BR /&gt;&lt;BR /&gt;check the diff command:&lt;BR /&gt;$diff fileA fileB&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Tue, 02 Oct 2007 04:28:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4079590#M735784</guid>
      <dc:creator>Oviwan</dc:creator>
      <dc:date>2007-10-02T04:28:54Z</dc:date>
    </item>
    <item>
      <title>Re: shell script problem..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4079591#M735785</link>
      <description>One of those "scrap of paper" moments - I haven't tried this but think it will work:&lt;BR /&gt;&lt;BR /&gt;for i in `cat fileA`&lt;BR /&gt;do&lt;BR /&gt;if grep $i fileB&lt;BR /&gt;then&lt;BR /&gt;:&lt;BR /&gt;else&lt;BR /&gt;echo $i&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Mark Syder (like the drink but spelt different)</description>
      <pubDate>Tue, 02 Oct 2007 04:32:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4079591#M735785</guid>
      <dc:creator>MarkSyder</dc:creator>
      <dc:date>2007-10-02T04:32:43Z</dc:date>
    </item>
    <item>
      <title>Re: shell script problem..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4079592#M735786</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;try this first:&lt;BR /&gt;$ sort fileA &amp;gt;./fileA.s&lt;BR /&gt;$ sort fileB  &amp;gt;./fileB.s&lt;BR /&gt;&lt;BR /&gt;$ comm -23 fileA.s fileB.s&lt;BR /&gt;629000&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.</description>
      <pubDate>Tue, 02 Oct 2007 04:36:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4079592#M735786</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2007-10-02T04:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: shell script problem..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4079593#M735787</link>
      <description>noo...&lt;BR /&gt;Problem is becouse file B is very big and also fileA&lt;BR /&gt;&lt;BR /&gt;files are not sorted..&lt;BR /&gt;so most of content from fileA is in fileB but there are 10-20 lines that are in fileA that fileB does not have..&lt;BR /&gt;&lt;BR /&gt;I think I got it..&lt;BR /&gt;sort -b fileA &amp;gt; fileA.sort&lt;BR /&gt;sort -b fileB &amp;gt; fileB.sort&lt;BR /&gt;&lt;BR /&gt;comm -23 fileA.sort fileB.sort</description>
      <pubDate>Tue, 02 Oct 2007 04:38:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4079593#M735787</guid>
      <dc:creator>amonamon</dc:creator>
      <dc:date>2007-10-02T04:38:41Z</dc:date>
    </item>
    <item>
      <title>Re: shell script problem..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4079594#M735788</link>
      <description>grep -v -f fileb filea</description>
      <pubDate>Tue, 02 Oct 2007 04:48:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4079594#M735788</guid>
      <dc:creator>Ian Lochray</dc:creator>
      <dc:date>2007-10-02T04:48:13Z</dc:date>
    </item>
    <item>
      <title>Re: shell script problem..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4079595#M735789</link>
      <description>Ian,&lt;BR /&gt;&lt;BR /&gt;Your solution will show every line that doesn't match. If one line matches and the other (say) 3000 don't, it will show him those 3000 lines.&lt;BR /&gt;&lt;BR /&gt;Mark</description>
      <pubDate>Tue, 02 Oct 2007 04:52:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4079595#M735789</guid>
      <dc:creator>MarkSyder</dc:creator>
      <dc:date>2007-10-02T04:52:56Z</dc:date>
    </item>
    <item>
      <title>Re: shell script problem..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4079596#M735790</link>
      <description>&amp;gt;can anyone give fast and good solution on this:&lt;BR /&gt;&lt;BR /&gt;Fast to run?  Or fast to implement?&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Mark: I haven't tried this but think it will work:&lt;BR /&gt;&lt;BR /&gt;Using grep will have terrible performance for large files.  Using that cat(1) will also tokenize each line, if there is more than one field that would fail.&lt;BR /&gt;&lt;BR /&gt;John has the right solution with sort and comm.  If there are duplicates, you may or may want to use sort -u.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;noo... Problem is because file B is very big and also fileA&lt;BR /&gt;&lt;BR /&gt;Were you complaining about the sort, sort, comm solution?&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Mark: Ian, Your solution will show every line that doesn't match.&lt;BR /&gt;&lt;BR /&gt;Isn't that what amonamon wants?  It gives 629000.  It will have all the lines of fileA that are not in fileB.</description>
      <pubDate>Tue, 02 Oct 2007 05:39:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4079596#M735790</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-10-02T05:39:31Z</dc:date>
    </item>
    <item>
      <title>Re: shell script problem..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4079597#M735791</link>
      <description>If fileA and fileB are about 2000 records, I get:&lt;BR /&gt;grep:&lt;BR /&gt;real    0m0.02s user    0m0.03s sys     0m0.01s&lt;BR /&gt;&lt;BR /&gt;sort, sort, comm:&lt;BR /&gt;real    0m0.07s user    0m0.01s sys     0m0.01s&lt;BR /&gt;&lt;BR /&gt;With 30,000 they break even and comm is better.</description>
      <pubDate>Tue, 02 Oct 2007 05:50:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4079597#M735791</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-10-02T05:50:00Z</dc:date>
    </item>
    <item>
      <title>Re: shell script problem..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4079598#M735792</link>
      <description>Dennis,&lt;BR /&gt;&lt;BR /&gt;I am assuming that Ian's solution would involve a loop like my earlier suggestion. The first iteration of the loop would do grep -v 123569 fileA. This would output every line in fileA that did not contain 123569. Similarly, the second iteration would output every line that did not contain 789999 etc.&lt;BR /&gt;&lt;BR /&gt;As Ian has written it, amonamon would actually be searching for the string fileB in fileA.&lt;BR /&gt;&lt;BR /&gt;Mark</description>
      <pubDate>Tue, 02 Oct 2007 05:50:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4079598#M735792</guid>
      <dc:creator>MarkSyder</dc:creator>
      <dc:date>2007-10-02T05:50:06Z</dc:date>
    </item>
    <item>
      <title>Re: shell script problem..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4079599#M735793</link>
      <description>&amp;gt;Mark: I am assuming that Ian's solution would involve a loop like my earlier suggestion.&lt;BR /&gt;&lt;BR /&gt;Any loop would be IN grep.  That's what grep -f does.  Looks at the file fileB for each string.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;The first iteration of the loop would do grep -v 123569 fileA.&lt;BR /&gt;&lt;BR /&gt;No.  grep looks at each record of fileA and if it matches any line of fileB, it isn't printed.  Perhaps you have your gedanken for-loops interchanged.  :-)&lt;BR /&gt;&lt;BR /&gt;&amp;gt;As Ian has written it, amonamon would actually be searching for the string fileB in fileA.&lt;BR /&gt;&lt;BR /&gt;That's not what "grep -v -f file" does.  Did you try it?</description>
      <pubDate>Tue, 02 Oct 2007 05:59:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4079599#M735793</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-10-02T05:59:44Z</dc:date>
    </item>
    <item>
      <title>Re: shell script problem..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4079600#M735794</link>
      <description>Hi Amonamon, this is the command:&lt;BR /&gt;&lt;BR /&gt;diff A B | grep "&amp;lt;" | awk '{print $2}'&lt;BR /&gt;&lt;BR /&gt;to satisfy your request.&lt;BR /&gt;&lt;BR /&gt;Best regards.&lt;BR /&gt;Ernesto</description>
      <pubDate>Tue, 02 Oct 2007 07:06:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4079600#M735794</guid>
      <dc:creator>Ernesto Cappello</dc:creator>
      <dc:date>2007-10-02T07:06:45Z</dc:date>
    </item>
    <item>
      <title>Re: shell script problem..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4079601#M735795</link>
      <description>Dennis,&lt;BR /&gt;&lt;BR /&gt;No, I missed the -f!&lt;BR /&gt;&lt;BR /&gt;I've never used it and have not tried it but will bear it in mind for future use.&lt;BR /&gt;&lt;BR /&gt;Mark</description>
      <pubDate>Tue, 02 Oct 2007 07:20:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4079601#M735795</guid>
      <dc:creator>MarkSyder</dc:creator>
      <dc:date>2007-10-02T07:20:55Z</dc:date>
    </item>
    <item>
      <title>Re: shell script problem..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4079602#M735796</link>
      <description>&amp;gt; any help..I tryed something with comm..but..no use..&lt;BR /&gt;&lt;BR /&gt;Did you sort the files before filtering your criteria thru comm(1) i.e.&lt;BR /&gt;&lt;BR /&gt;# sort fileA &amp;gt; sfA&lt;BR /&gt;# sort fileB &amp;gt; sfB&lt;BR /&gt;# comm -23 sfA sfB&lt;BR /&gt;629000</description>
      <pubDate>Tue, 02 Oct 2007 10:48:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4079602#M735796</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-10-02T10:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: shell script problem..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4079603#M735797</link>
      <description>a faster alogrithm would be to use awk or perl to read in file b put everything in an array or hash, the read file a and check to see if entry is in the hash if it isn't print it.&lt;BR /&gt;&lt;BR /&gt;something like this.  maybe someone that knows perl can correct my mistakes.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;open(FILEHANDLE,"&lt;FILEB&gt;&lt;/FILEB&gt;&lt;BR /&gt;while (&lt;FILEHANDLE&gt;){&lt;BR /&gt;@a[chop()]=1;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;open(FILEHANDLE,"&lt;FILEA&gt;&lt;/FILEA&gt;&lt;BR /&gt;while (&lt;FILEHANDLE&gt;){&lt;BR /&gt; if @a[chop()] print;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;/FILEHANDLE&gt;&lt;/FILEHANDLE&gt;</description>
      <pubDate>Tue, 02 Oct 2007 10:55:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4079603#M735797</guid>
      <dc:creator>blah2blah</dc:creator>
      <dc:date>2007-10-02T10:55:22Z</dc:date>
    </item>
    <item>
      <title>Re: shell script problem..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4079604#M735798</link>
      <description>never mind my post...John Korterman beat me to it by a mile :)</description>
      <pubDate>Tue, 02 Oct 2007 12:29:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4079604#M735798</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-10-02T12:29:37Z</dc:date>
    </item>
  </channel>
</rss>

