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
^
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)
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.