<?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: Easy points  awk question in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907084#M719752</link>
    <description>OK,&lt;BR /&gt;&lt;BR /&gt;With the latest input you provide, here is the modified script again.&lt;BR /&gt;&lt;BR /&gt;while read entry                            &lt;BR /&gt;do                                          &lt;BR /&gt;/usr/bin/awk -v value=$entry '              &lt;BR /&gt;$1 == value || $2 == value {print $1}' data &lt;BR /&gt;done &amp;lt; index                                &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;here &lt;BR /&gt;&lt;BR /&gt;data = your database&lt;BR /&gt;index = inputfile1&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
    <pubDate>Tue, 18 Feb 2003 22:12:40 GMT</pubDate>
    <dc:creator>Sridhar Bhaskarla</dc:creator>
    <dc:date>2003-02-18T22:12:40Z</dc:date>
    <item>
      <title>Easy points  awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907053#M719721</link>
      <description>One liner or maybe two &lt;BR /&gt;&lt;BR /&gt;Input file with one field (50,000+ lines)&lt;BR /&gt;compare each line to another file, if the $1 matches the first field of the 2nd input file(like a grep,but awk is faster), write that 2nd file line to another file(outfile) otherwise skip to the next record in file 1.</description>
      <pubDate>Tue, 18 Feb 2003 14:55:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907053#M719721</guid>
      <dc:creator>Belinda Dermody</dc:creator>
      <dc:date>2003-02-18T14:55:33Z</dc:date>
    </item>
    <item>
      <title>Re: Easy points  awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907054#M719722</link>
      <description>Hi James:&lt;BR /&gt;&lt;BR /&gt;How about 'comm':&lt;BR /&gt;&lt;BR /&gt;# comm -3 file1 file2 &amp;gt; newfile&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 18 Feb 2003 15:05:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907054#M719722</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2003-02-18T15:05:23Z</dc:date>
    </item>
    <item>
      <title>Re: Easy points  awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907055#M719723</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;Ooops, I think you wanted the inverse:&lt;BR /&gt;&lt;BR /&gt;# comm -12 file1 file2 &amp;gt; newfile&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 18 Feb 2003 15:06:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907055#M719723</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2003-02-18T15:06:44Z</dc:date>
    </item>
    <item>
      <title>Re: Easy points  awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907056#M719724</link>
      <description>You need 'join'. Both files need to be sorted. Join is made for this purpose.&lt;BR /&gt;&lt;BR /&gt;Enjoy, have FUN! H.Merijn</description>
      <pubDate>Tue, 18 Feb 2003 15:22:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907056#M719724</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2003-02-18T15:22:03Z</dc:date>
    </item>
    <item>
      <title>Re: Easy points  awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907057#M719725</link>
      <description>Jim, neither one gives me the correct results&lt;BR /&gt;&lt;BR /&gt;comm -3 &lt;FILE1&gt; &lt;FILE2&gt; &amp;gt; file3 gives me all the lines of file and file2 in file3.&lt;BR /&gt;comm -2 &lt;FILE1&gt; &lt;FILE2&gt; &amp;gt; file3 gives me nothing.&lt;BR /&gt;File one will always have one field and that one field will either be in file2 or not, if in file2 put it in file file&lt;BR /&gt;&lt;BR /&gt;sample file1&lt;BR /&gt;abc@abc.om&lt;BR /&gt;def@def.com      # will not be in file2&lt;BR /&gt;xyz@xyz.com&lt;BR /&gt;etc..  &lt;BR /&gt;etc..&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;sampe file2&lt;BR /&gt;   abc@abc.com         abc123.xyz.net&lt;BR /&gt;   xyz@xyz.com         axz999.yahoo.com&lt;BR /&gt;   etc.....            etc.....&lt;BR /&gt;&lt;BR /&gt;expected file3&lt;BR /&gt;abc@abc.om&lt;BR /&gt;xyz@xyz.com&lt;BR /&gt;   &lt;BR /&gt;&lt;/FILE2&gt;&lt;/FILE1&gt;&lt;/FILE2&gt;&lt;/FILE1&gt;</description>
      <pubDate>Tue, 18 Feb 2003 15:32:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907057#M719725</guid>
      <dc:creator>Belinda Dermody</dc:creator>
      <dc:date>2003-02-18T15:32:51Z</dc:date>
    </item>
    <item>
      <title>Re: Easy points  awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907058#M719726</link>
      <description>Hi,&lt;BR /&gt;Try:&lt;BR /&gt;join -1 1 -2 1 -o 2.1,2.2,2.3 &lt;FILE1&gt; &lt;FILE2&gt;&lt;/FILE2&gt;&lt;/FILE1&gt;</description>
      <pubDate>Tue, 18 Feb 2003 15:37:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907058#M719726</guid>
      <dc:creator>Leif Halvarsson_2</dc:creator>
      <dc:date>2003-02-18T15:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: Easy points  awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907059#M719727</link>
      <description>Hi James,&lt;BR /&gt;&lt;BR /&gt;first file = file1&lt;BR /&gt;second file = file2&lt;BR /&gt;&lt;BR /&gt;while read entry              &lt;BR /&gt;do                            &lt;BR /&gt;/usr/bin/awk -v value=$entry '&lt;BR /&gt;$1==value {print $0}' file2   &lt;BR /&gt;done &amp;lt; file1                  &lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Tue, 18 Feb 2003 15:53:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907059#M719727</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2003-02-18T15:53:46Z</dc:date>
    </item>
    <item>
      <title>Re: Easy points  awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907060#M719728</link>
      <description>I thought this would be easy not correct yet.&lt;BR /&gt;&lt;BR /&gt;I thought Leif had the answer.  But as an example &lt;BR /&gt;&lt;BR /&gt;abc@abc.com from file1 (master listing) was in file1 85 times, but using Leif it gave me a count of only four times.&lt;BR /&gt;&lt;BR /&gt;And Jim, this is the first time that you have unable to provide the correct result the first response.</description>
      <pubDate>Tue, 18 Feb 2003 15:54:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907060#M719728</guid>
      <dc:creator>Belinda Dermody</dc:creator>
      <dc:date>2003-02-18T15:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: Easy points  awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907061#M719729</link>
      <description>Hi (again) James:&lt;BR /&gt;&lt;BR /&gt;OK, when you said "line" I took you literally.  Merijn (Procura) offered the better command.  Try this:&lt;BR /&gt;&lt;BR /&gt;# join -a2 file1 file2 &amp;gt; newfile&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 18 Feb 2003 16:00:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907061#M719729</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2003-02-18T16:00:28Z</dc:date>
    </item>
    <item>
      <title>Re: Easy points  awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907062#M719730</link>
      <description>Pure (somewhat upgly) awk... slow, but should work with unsorted files.&lt;BR /&gt;&lt;BR /&gt;awk '&lt;BR /&gt;{&lt;BR /&gt;  while (getline line &amp;lt; "file2") {&lt;BR /&gt;    split (line, l);&lt;BR /&gt;    if ($1 == l[1])&lt;BR /&gt;      print ($1);&lt;BR /&gt;  }&lt;BR /&gt;  close ("file2");&lt;BR /&gt;}' &amp;lt; file1 &amp;gt; file3&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;If you need the complete "2nd file line" in the output, replace print ($1) with print (line).&lt;BR /&gt;&lt;BR /&gt;Best regards...&lt;BR /&gt; Dietmar.</description>
      <pubDate>Tue, 18 Feb 2003 16:06:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907062#M719730</guid>
      <dc:creator>Dietmar Konermann</dc:creator>
      <dc:date>2003-02-18T16:06:21Z</dc:date>
    </item>
    <item>
      <title>Re: Easy points  awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907063#M719731</link>
      <description>If the second file has unique entries, then here is a short perl program (substitute your 2nd file name for "lookupfile")-&lt;BR /&gt;&lt;BR /&gt;open(INP,"&lt;LOOKUPFILE&gt;&lt;/LOOKUPFILE&gt;while(&lt;INP&gt;) { chomp; ($key,$rest)=split(" ",$_,2); $lu{$key}=$_; }&lt;BR /&gt;close(INP);&lt;BR /&gt;while(&amp;lt;&amp;gt;) { chomp; print $lu{$key},"\n" if $lu{$key}; }&lt;BR /&gt;&lt;BR /&gt;Run by entering-&lt;BR /&gt;perl aboveprogram.pl firstfile&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills&lt;/INP&gt;</description>
      <pubDate>Tue, 18 Feb 2003 16:20:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907063#M719731</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2003-02-18T16:20:24Z</dc:date>
    </item>
    <item>
      <title>Re: Easy points  awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907064#M719732</link>
      <description>Whoops-&lt;BR /&gt;&lt;BR /&gt;On the last line of the perl program use "$_" instead of "$key".&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Tue, 18 Feb 2003 16:27:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907064#M719732</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2003-02-18T16:27:56Z</dc:date>
    </item>
    <item>
      <title>Re: Easy points  awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907065#M719733</link>
      <description>Hi,&lt;BR /&gt;The two files has to be sorted on the join fild before using "join".&lt;BR /&gt;</description>
      <pubDate>Tue, 18 Feb 2003 16:28:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907065#M719733</guid>
      <dc:creator>Leif Halvarsson_2</dc:creator>
      <dc:date>2003-02-18T16:28:15Z</dc:date>
    </item>
    <item>
      <title>Re: Easy points  awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907066#M719734</link>
      <description>Hi!&lt;BR /&gt;Try:&lt;BR /&gt;&lt;BR /&gt;for unm in `awk -F: '{print $0}' &lt;FILE1&gt;; &lt;BR /&gt;do&lt;BR /&gt;awk -v v1=$unm 'match($0,v1){print substr($0,RSTART,RLENGTH)}' &lt;FILE2&gt;   &amp;gt;   &lt;FILE3&gt;&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;FILE1&gt; - input file&lt;BR /&gt;&lt;FILE2&gt; - 2nd input file&lt;BR /&gt;&lt;FILE3&gt; - result&lt;BR /&gt;&lt;BR /&gt;Regards.&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;&lt;/FILE3&gt;&lt;/FILE2&gt;&lt;/FILE1&gt;&lt;/FILE3&gt;&lt;/FILE2&gt;&lt;/FILE1&gt;</description>
      <pubDate>Tue, 18 Feb 2003 16:52:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907066#M719734</guid>
      <dc:creator>Stanimir</dc:creator>
      <dc:date>2003-02-18T16:52:22Z</dc:date>
    </item>
    <item>
      <title>Re: Easy points  awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907067#M719735</link>
      <description>Thanks for all the tries, nothing has come close to giving the correct results.  The awk statements keep on bailing out on line 1; the good old helpful error msg.&lt;BR /&gt;&lt;BR /&gt;The join doesnt come even close to separating the files correctly, I sorted the two input files.  I guess I will have to try to Perl option next.&lt;BR /&gt;&lt;BR /&gt;But once again thanks for all the response and suggestions.  I will assign points as soon as I double check my work and make sure I have had any finger checks on typing in.</description>
      <pubDate>Tue, 18 Feb 2003 19:07:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907067#M719735</guid>
      <dc:creator>Belinda Dermody</dc:creator>
      <dc:date>2003-02-18T19:07:54Z</dc:date>
    </item>
    <item>
      <title>Re: Easy points  awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907068#M719736</link>
      <description>Your awk error is not caused by the posted scripts... just checked some of them. Maybe a copy/paste problem?</description>
      <pubDate>Tue, 18 Feb 2003 19:24:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907068#M719736</guid>
      <dc:creator>Dietmar Konermann</dc:creator>
      <dc:date>2003-02-18T19:24:52Z</dc:date>
    </item>
    <item>
      <title>Re: Easy points  awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907069#M719737</link>
      <description>Thanks Dietmar; found a missing closing ', but still no output&lt;BR /&gt;#!/bin/sh -xv&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;awk '&lt;BR /&gt;{&lt;BR /&gt;while (getline line &amp;lt; tmpusertable) {&lt;BR /&gt;split (line,l);&lt;BR /&gt;if($1 == l[1])&lt;BR /&gt;print ($1);&lt;BR /&gt;} &lt;BR /&gt;close (tmpusertable);&lt;BR /&gt;}' &amp;lt; work6 &amp;gt; work7&lt;BR /&gt;&lt;BR /&gt;This way it runs 5 seconds and work7 is empty.&lt;BR /&gt;&lt;BR /&gt;work6 has 24,000 lines and tmpusertable has 250,000 lines and I expect work7 to have about 18,000 lines.&lt;BR /&gt;&lt;BR /&gt;If I put " " around tmpusertable like you have in the example it runs, but work7 is nothing but empty lines, I killed it after 32,000</description>
      <pubDate>Tue, 18 Feb 2003 20:25:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907069#M719737</guid>
      <dc:creator>Belinda Dermody</dc:creator>
      <dc:date>2003-02-18T20:25:13Z</dc:date>
    </item>
    <item>
      <title>Re: Easy points  awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907070#M719738</link>
      <description>Hi James,&lt;BR /&gt;please try the attached semi-awk script, but first  replace &lt;FILE1&gt; and &lt;FILE2&gt; with the paths to your input files.&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.&lt;/FILE2&gt;&lt;/FILE1&gt;</description>
      <pubDate>Tue, 18 Feb 2003 20:28:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907070#M719738</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2003-02-18T20:28:42Z</dc:date>
    </item>
    <item>
      <title>Re: Easy points  awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907071#M719739</link>
      <description>Hi,&lt;BR /&gt;I am not sure I have understand you correct but I used your example and added some lines to file1 (xxx in my test).&lt;BR /&gt;&lt;BR /&gt;# cat xxx&lt;BR /&gt;abc@abc.com&lt;BR /&gt;def@def.com&lt;BR /&gt;xyz@xyz.com &lt;BR /&gt;abc@abc.com &lt;BR /&gt;abc@abc.com&lt;BR /&gt;abc@abc.com&lt;BR /&gt;abc@abc.com&lt;BR /&gt;# &lt;BR /&gt;# cat yyy&lt;BR /&gt;abc@abc.com abc123.xyz.net &lt;BR /&gt;xyz@xyz.com axz999.yahoo.com &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;# sort xxx &amp;gt;zzz&lt;BR /&gt;# join -1 1 -2 1 -o 2.1 zzz yyy&lt;BR /&gt;abc@abc.com&lt;BR /&gt;abc@abc.com&lt;BR /&gt;abc@abc.com&lt;BR /&gt;abc@abc.com&lt;BR /&gt;abc@abc.com&lt;BR /&gt;xyz@xyz.com&lt;BR /&gt;&lt;BR /&gt;Of course yyy need to be sorted too but in the example this was already done.&lt;BR /&gt;</description>
      <pubDate>Tue, 18 Feb 2003 20:28:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907071#M719739</guid>
      <dc:creator>Leif Halvarsson_2</dc:creator>
      <dc:date>2003-02-18T20:28:50Z</dc:date>
    </item>
    <item>
      <title>Re: Easy points  awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907072#M719740</link>
      <description>The problem is there might be address in file xxx that does not match either one of the addresses on the line in file yyy and if so I do not want them in the report.  &lt;BR /&gt;File xxx is addresses coming in.  File yyy has the incoming address and a possible forwarding addres.&lt;BR /&gt;&lt;BR /&gt;Your lines of xxx always match something in yyy&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 18 Feb 2003 20:34:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/easy-points-awk-question/m-p/2907072#M719740</guid>
      <dc:creator>Belinda Dermody</dc:creator>
      <dc:date>2003-02-18T20:34:39Z</dc:date>
    </item>
  </channel>
</rss>

