awk to compare lines of two files and print output on screen

hey guys, I have two files both with two columns, I have already created an
awk code to ignore certain lines (e.g lines that start with 963) as they wou
ld begin with a certain string, however, the rest I have added together and
calculated the average.

At the moment the code also displays the two files in one list showing just
the lines it used to calculate the average.

e.g

FILE1
812353124 54
812535352 55
864235235 99
963352351 35

FILE2 
812353124 75
815342325 93
864235235 52
963546253 46

***
output on screen

812353124 54
812535352 55
864235235 99
812353124 75
815342325 93
864235235 52

Average: <number calculated>

***

What I want to do now though is to compare each line on both files, and if t
he first column of a line matches one in the second file, it will print a th
ird column with that file. If one line doesn't match in the other file, the
third column will have a * on that line.

Example of output

812353124 54 75
812535352 55 *
864235235 99 52
812353124 75 *
815342325 93 *

as you can see, there are no doubles of lines that match in the first column

Post your code and we'll see if we can assist.

Regards

please delete reply

Hi,

Follow code does not address your issue totally, but at least i think it can help you a little.

nawk 'NR==FNR {
if ($1 !~ /^963/)
{
t[$1]=$2
m[$1]=$0
}
}
NR!=FNR{
if ($1 !~ /^963/)
{
if (t[$1]!="")
t[$1]=sprintf("%s %s",$0,t[$1])
else
t[$1]=sprintf("%s *",$0)
}
}
END{
for (i in t)
if(index(t," ")!=0)
	print t
else
	print m" *"
}' file2 file1