Join On A String

Is is possible to join on unsorted files by a string? Don't want to sort because there is other text that is already in a good format.

File1 has this text string:
ABCD-123 FGH

File2 has this text string:
ABCD-123

I want to replace or join ABCD-123 in file 2 with ABCD-123 FGH in file 1.
Thank you.

What output would you want for that input?

Desired output would be for file2: ABCD-123 FGH. There are multiple ones though. So it would be:
ABCD-123 FGH and BCDE-345 JKL etc.
Not using sed because each instance is unique. Not sure if I'm being clear.

---------- Post updated at 03:24 PM ---------- Previous update was at 03:17 PM ----------

Just looked at my response, let me re-phrase it.
Desired output would be
ABCD-123 AAA
ABCD-456 BBB
ABCD-789 CCC
But these would appear in different places in the text file. Hope this is clearer and I do appreciate the help.

awk 'NR==FNR { A[$1]=1; next } $1 in A' file2 file1

syntax error Corona

Which syntax error?

Use nawk on solaris.

Maybe it should be:

awk 'NR==FNR { A[$1]=$1; next } $1 in A' file2 file1
                     ^
                  Missing

Sorry, just read the post and thought "this is the error"; just did not test it yet.
(I HATE variable spacing fonts! Had to edit this post too many times just to align the arrow with the error)

There is no syntax error. I tried it myself.

Either it is mistyped, or he is using ancient solaris awk.

yes nawk runs but I'm not getting any output

---------- Post updated at 03:53 PM ---------- Previous update was at 03:49 PM ----------

Yes nawk works but I'm not getting any output. hm

Then the input you are using does not match the data you posted -- or is just taking ages to process because the files are enormous. Please post a relevant sample.

If the files are too large, you'll need to sort and join them anyway.

a.log: RBOSK-374            AAA-B04-D16-K01
a.log: 0  XXX 602 14/1          R14A        
a.log: 2  XXX 119 128/1         R1B         
a.log: 3  XXX 119 128/1         R1B         
a.log: 4  XXX 119 128/1         R1B         
a.log: 5  XXX 231 201/1         R10B        
a.log: 6  XXX 231 201/1         R5C         
b.log: RBOSK-70  NB9292 
b.log: RBOSK-374 NB2781 
b.log: RBOSK-73  JO1794 
b.log: RBOSK-83  OK1987  
b.log: RBOSK-85  LY1983 

I would want to file "a" to be like this:

a.log: NB2781          AAA-B04-D16-K01      
a.log: 0  XXX 602 14/1          R14A        
a.log: 2  XXX 119 128/1         R1B         
a.log: 3  XXX 119 128/1         R1B         
a.log: 4  XXX 119 128/1         R1B         
a.log: 5  XXX 231 201/1         R10B        
a.log: 6  XXX 231 201/1         R5C

do the a.log and b.log files actually contain the text "a.log: " and "b.log: " ?