AWK help, matching 2 files into one

I'm newbie with AWK. What I'm trying to do is matching file1 and file2 into a file3 with records listed in columns with pipe as delimiter.

The thing is the file1 has thousands of records while file2 has very few. But I want the file3 to show all records in file1 and with data from file2 to be added on those that exists on file1 and leave a one space for those that doesn't exist on file2. All on one line for each matched record. Know what I mean?

I looked all over for AWK that do this. I tried the JOIN method, it doesn't work as it has to be sorted and matched but it did not succeed due to too many records in file1 and few in file2.

Appreciate any help!!

Jmeasel7

---------- Post updated at 11:18 PM ---------- Previous update was at 11:09 PM ----------

what i need is like this

file1:

rec1|11111|11111|11111
rec2|22222|22222|22222
rec3|33333|33333|33333
rec4|44444|44444|44444

file2:

rec2|55555
rec4|77777

result I want for file3:

rec1|11111|11111|11111|
rec2|22222|22222|22222|55555
rec3|33333|33333|33333|
rec4|44444|44444|44444|77777
awk -F \| 'NR==FNR{a[$1]=$2;next} {print $0 (a[$1]==""?X:"|"a[$1])}' file2 file1

That's exactly what I needed. Thank you!