<?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: Uregent : Record Comparison Between 3 files in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/uregent-record-comparison-between-3-files/m-p/2488044#M19063</link>
    <description>What about diff?! (see man diff)</description>
    <pubDate>Wed, 31 Jan 2001 06:40:50 GMT</pubDate>
    <dc:creator>Jacques Simon</dc:creator>
    <dc:date>2001-01-31T06:40:50Z</dc:date>
    <item>
      <title>Uregent : Record Comparison Between 3 files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/uregent-record-comparison-between-3-files/m-p/2488041#M19060</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;I need to compare 3 files in this manner. &lt;BR /&gt;&lt;BR /&gt;First i will take file1 and compare each and every record of file1 in terms of field with other 2 files. Based on process rules, i should do some action.&lt;BR /&gt;&lt;BR /&gt;My question is how i can do record comparison among files ? I am trying to do this with Shell Scripting, AWK.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Could some one tell me the how can i &lt;BR /&gt;achive it ?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Awaiting your early reply.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Bala</description>
      <pubDate>Tue, 30 Jan 2001 16:54:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/uregent-record-comparison-between-3-files/m-p/2488041#M19060</guid>
      <dc:creator>Balasubramanian</dc:creator>
      <dc:date>2001-01-30T16:54:17Z</dc:date>
    </item>
    <item>
      <title>Re: Uregent : Record Comparison Between 3 files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/uregent-record-comparison-between-3-files/m-p/2488042#M19061</link>
      <description>Hi ,&lt;BR /&gt;&lt;BR /&gt;Look at the comm command</description>
      <pubDate>Tue, 30 Jan 2001 17:03:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/uregent-record-comparison-between-3-files/m-p/2488042#M19061</guid>
      <dc:creator>Vikas Khator</dc:creator>
      <dc:date>2001-01-30T17:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: Uregent : Record Comparison Between 3 files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/uregent-record-comparison-between-3-files/m-p/2488043#M19062</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Take a look at the man pages for 'diff' and 'cmp'.&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 30 Jan 2001 17:04:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/uregent-record-comparison-between-3-files/m-p/2488043#M19062</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2001-01-30T17:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: Uregent : Record Comparison Between 3 files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/uregent-record-comparison-between-3-files/m-p/2488044#M19063</link>
      <description>What about diff?! (see man diff)</description>
      <pubDate>Wed, 31 Jan 2001 06:40:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/uregent-record-comparison-between-3-files/m-p/2488044#M19063</guid>
      <dc:creator>Jacques Simon</dc:creator>
      <dc:date>2001-01-31T06:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: Uregent : Record Comparison Between 3 files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/uregent-record-comparison-between-3-files/m-p/2488045#M19064</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Thank you all for your reply.&lt;BR /&gt;&lt;BR /&gt;Even if i am using 'comm' or diff command i can compare only 2 files. In my case i have to compare the entire record field by field from the first file with the other two files (again record field by field).&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Awaiting ur reply.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Bala</description>
      <pubDate>Thu, 01 Feb 2001 21:25:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/uregent-record-comparison-between-3-files/m-p/2488045#M19064</guid>
      <dc:creator>Balasubramanian</dc:creator>
      <dc:date>2001-02-01T21:25:45Z</dc:date>
    </item>
    <item>
      <title>Re: Uregent : Record Comparison Between 3 files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/uregent-record-comparison-between-3-files/m-p/2488046#M19065</link>
      <description>do your files all have the same number of records?  do all the records have the same number of fields?  What is your field seperator?&lt;BR /&gt;&lt;BR /&gt;in the korn shell do something like this:&lt;BR /&gt;&lt;BR /&gt;#save your IFS variable&lt;BR /&gt;OLDIFS=$IFS&lt;BR /&gt;&lt;BR /&gt;#set IFS to your field seperator&lt;BR /&gt;IFS=","   # comma seperated fields,&lt;BR /&gt;          # probably want to add your &lt;BR /&gt;          # record seperator here too&lt;BR /&gt;&lt;BR /&gt;# open file descriptor to the files to be compared&lt;BR /&gt;&lt;BR /&gt;exec 3&amp;lt; file1&lt;BR /&gt;exec 4&amp;lt; file2&lt;BR /&gt;&lt;BR /&gt;cat yourfile |&lt;BR /&gt;while read field&lt;BR /&gt;do&lt;BR /&gt;   read -u3 field1&lt;BR /&gt;   read -u4 field2&lt;BR /&gt;   if [[ $field != field1 ]] ;then&lt;BR /&gt;       if [[ $field != field2 ]] ;then&lt;BR /&gt;          do_case1 #!!&lt;BR /&gt;       else&lt;BR /&gt;          do_case2 #!=&lt;BR /&gt;       fi&lt;BR /&gt;   else&lt;BR /&gt;       if [[ $field != field2 ]] ;then&lt;BR /&gt;          do_case3  #=!&lt;BR /&gt;       else&lt;BR /&gt;          do_case4  #==&lt;BR /&gt;       fi&lt;BR /&gt;   fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;IFS=$OLDIFS&lt;BR /&gt;&lt;BR /&gt;of course this assumes same number of records in each file and the same number of fields in each record.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 01 Feb 2001 22:25:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/uregent-record-comparison-between-3-files/m-p/2488046#M19065</guid>
      <dc:creator>Curtis Larson</dc:creator>
      <dc:date>2001-02-01T22:25:24Z</dc:date>
    </item>
    <item>
      <title>Re: Uregent : Record Comparison Between 3 files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/uregent-record-comparison-between-3-files/m-p/2488047#M19066</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;To acomplish this task I often use join command.  &lt;BR /&gt;&lt;BR /&gt;i.e: &lt;BR /&gt;sort f1 &amp;gt; f1.o&lt;BR /&gt;sort f2 &amp;gt; f2.o&lt;BR /&gt;sort f3 &amp;gt; f3.o&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;join -a 1 -a 2 -e "MISSING" -o 1.1 1.2 ... 2.1 2.2 file1.o file2.o &amp;gt; j1&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;join -a 1 -a 2 -e "MISSING" -o 1.1 1.2 ... 2.1 2.2 j1 file3.o &amp;gt; j2&lt;BR /&gt;&lt;BR /&gt;And now  is very easy to process with awk.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;See man paste and join.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 02 Feb 2001 12:40:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/uregent-record-comparison-between-3-files/m-p/2488047#M19066</guid>
      <dc:creator>Carlos Fernandez Riera</dc:creator>
      <dc:date>2001-02-02T12:40:52Z</dc:date>
    </item>
    <item>
      <title>Re: Uregent : Record Comparison Between 3 files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/uregent-record-comparison-between-3-files/m-p/2488048#M19067</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;in Xemacs editor, have a look at :&lt;BR /&gt;Tools-&amp;gt;Compare-&amp;gt;Three files...</description>
      <pubDate>Fri, 02 Feb 2001 13:33:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/uregent-record-comparison-between-3-files/m-p/2488048#M19067</guid>
      <dc:creator>Andre Lattier</dc:creator>
      <dc:date>2001-02-02T13:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: Uregent : Record Comparison Between 3 files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/uregent-record-comparison-between-3-files/m-p/2488049#M19068</link>
      <description>Hi &lt;BR /&gt;&lt;BR /&gt;Thanks every one for your reply.&lt;BR /&gt;&lt;BR /&gt;Larson, my input files have the different no. of records and have the same no. of fields.&lt;BR /&gt;The field separator is pipe symbol (|).&lt;BR /&gt;&lt;BR /&gt;I tried with this script,&lt;BR /&gt;&lt;BR /&gt;Korn Shell&lt;BR /&gt;==========&lt;BR /&gt;&lt;BR /&gt;OLDIFS="$IFS"&lt;BR /&gt;IFS=|&lt;BR /&gt;echo "Enter the first file"&lt;BR /&gt;read file1&lt;BR /&gt;echo "enter the second file"&lt;BR /&gt;read file2&lt;BR /&gt;exec 3&amp;lt;$file1&lt;BR /&gt;exec 4&amp;lt;$file2&lt;BR /&gt;exec 5&amp;gt;match&lt;BR /&gt;exec 6&amp;gt;nomatch&lt;BR /&gt;while read -u3 lineA&lt;BR /&gt;do&lt;BR /&gt;read -u4 lineB&lt;BR /&gt;if [ "$lineA" = "$lineB" ]&lt;BR /&gt;then&lt;BR /&gt;print -u5 "$lineA"&lt;BR /&gt;else&lt;BR /&gt;print -u6 "$lineA; $lineB"&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;IFS=$OLDIFS&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;This scripts compare the records one after another from both the files. But what i need is,&lt;BR /&gt;&lt;BR /&gt;i have to take a record from the first file (say file1) and compare that record with each and every record of the second file (say file2)&lt;BR /&gt;until EOF of file2. Similarly till EOF of file1.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Could you pl. anyone tell me how can i write the script to do this ?&lt;BR /&gt;&lt;BR /&gt;I have a requirement to compare not only at the record level but i need to compare at the field level.&lt;BR /&gt;&lt;BR /&gt;Awaiting your reply.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Bala</description>
      <pubDate>Mon, 05 Feb 2001 14:54:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/uregent-record-comparison-between-3-files/m-p/2488049#M19068</guid>
      <dc:creator>Balasubramanian</dc:creator>
      <dc:date>2001-02-05T14:54:19Z</dc:date>
    </item>
    <item>
      <title>Re: Uregent : Record Comparison Between 3 files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/uregent-record-comparison-between-3-files/m-p/2488050#M19069</link>
      <description>not exactly elagant but should get the job done:&lt;BR /&gt;&lt;BR /&gt;#read each line of your file&lt;BR /&gt;while read -u3 line&lt;BR /&gt;do&lt;BR /&gt;    #test line against these files&lt;BR /&gt;    for i in file1 file2&lt;BR /&gt;    do&lt;BR /&gt;        #get each line that is different + the line number&lt;BR /&gt;        grep -nvx "$line" file1 |&lt;BR /&gt;        while read dfline&lt;BR /&gt;        do&lt;BR /&gt;            #get the line number that is different&lt;BR /&gt;            numRec=$(print "$dfline" | cut -d: -f1)&lt;BR /&gt;            dfline=$(print "$dfline" | cut -d: -f2-)&lt;BR /&gt;&lt;BR /&gt;            numFields=$(print "$dfline" | awk -F\| '{print NF;}')&lt;BR /&gt;&lt;BR /&gt;            (( x = 0 ))&lt;BR /&gt;            while (( $x &amp;lt; $numFields ))&lt;BR /&gt;            do&lt;BR /&gt;                (( x = $x + 1 ))&lt;BR /&gt;                field=$(print "$line" | cut -d: -f"$x")&lt;BR /&gt;                field1=$(print "$dfline" | cut -d: -f"$x")&lt;BR /&gt;&lt;BR /&gt;                if [[ "$field" != "$field1" ]] ;then&lt;BR /&gt;                    print "$file1:$numRec:$x:$field:$field1"&lt;BR /&gt;                fi&lt;BR /&gt;            done&lt;BR /&gt;        done&lt;BR /&gt;    done&lt;BR /&gt;done&lt;BR /&gt;</description>
      <pubDate>Mon, 05 Feb 2001 16:11:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/uregent-record-comparison-between-3-files/m-p/2488050#M19069</guid>
      <dc:creator>Curtis Larson</dc:creator>
      <dc:date>2001-02-05T16:11:39Z</dc:date>
    </item>
    <item>
      <title>Re: Uregent : Record Comparison Between 3 files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/uregent-record-comparison-between-3-files/m-p/2488051#M19070</link>
      <description>a bit better:&lt;BR /&gt;exec 3&amp;lt; yourfile&lt;BR /&gt;&lt;BR /&gt;files="$*"&lt;BR /&gt;#test line against these files&lt;BR /&gt;for i in $files&lt;BR /&gt;do&lt;BR /&gt;    #read each line of your file&lt;BR /&gt;    while read -u3 line&lt;BR /&gt;    do&lt;BR /&gt;        #get each line that is different + the line number&lt;BR /&gt;        grep -nvx "$line" $i |&lt;BR /&gt;        while read dfline&lt;BR /&gt;        do&lt;BR /&gt;            #get the line number that is different&lt;BR /&gt;            numRec=$(print "$dfline" | cut -d: -f1)&lt;BR /&gt;            dfline=$(print "$dfline" | cut -d: -f2-)&lt;BR /&gt;&lt;BR /&gt;            set -- $(print $line | tr "\|" " ")&lt;BR /&gt;            set -A fields $(print $dfline | tr "\|" " ")&lt;BR /&gt;            (( x = 0 ))&lt;BR /&gt;            while (( $# &amp;gt; 0 ))&lt;BR /&gt;            do&lt;BR /&gt;                if [[ "$1" != "${fields[$x]}" ]] ;then&lt;BR /&gt;                    print "$i:$numRec:$x:$1:${fields[$x]}"&lt;BR /&gt;                fi&lt;BR /&gt;                shift&lt;BR /&gt;                (( x = $x + 1 ))&lt;BR /&gt;            done&lt;BR /&gt;        done&lt;BR /&gt;    done&lt;BR /&gt;done&lt;BR /&gt;</description>
      <pubDate>Mon, 05 Feb 2001 17:01:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/uregent-record-comparison-between-3-files/m-p/2488051#M19070</guid>
      <dc:creator>Curtis Larson</dc:creator>
      <dc:date>2001-02-05T17:01:45Z</dc:date>
    </item>
    <item>
      <title>Re: Uregent : Record Comparison Between 3 files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/uregent-record-comparison-between-3-files/m-p/2488052#M19071</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks to Larson and others who shared idea/logic of implementing the comparison of record among three files.&lt;BR /&gt;&lt;BR /&gt;Done it with all your support.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks once again.&lt;BR /&gt;&lt;BR /&gt;-Bala</description>
      <pubDate>Wed, 21 Feb 2001 16:01:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/uregent-record-comparison-between-3-files/m-p/2488052#M19071</guid>
      <dc:creator>Balasubramanian</dc:creator>
      <dc:date>2001-02-21T16:01:05Z</dc:date>
    </item>
    <item>
      <title>Re: Uregent : Record Comparison Between 3 files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/uregent-record-comparison-between-3-files/m-p/2488053#M19072</link>
      <description>Hi Bala,&lt;BR /&gt;&lt;BR /&gt;It's nice to say 'Thanks' but it would be a lot nicer if you assigned points to the people who spent some time (or a lot of) to help you.&lt;BR /&gt;&lt;BR /&gt;Thanks for them,&lt;BR /&gt;&lt;BR /&gt;No point for me please ! &lt;BR /&gt;&lt;BR /&gt;Dan&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 22 Feb 2001 06:16:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/uregent-record-comparison-between-3-files/m-p/2488053#M19072</guid>
      <dc:creator>Dan Hetzel</dc:creator>
      <dc:date>2001-02-22T06:16:50Z</dc:date>
    </item>
  </channel>
</rss>

