Merge file lines based off of keyword

Hello Everyone,
I have two files I created in a format similar to the ones found below (character position is important):

File 1:

21 Cat Y N S Y Y N N 
FOUR LEGS
TAIL
WHISKERS
30 Dog N N 1 Y Y N N 
FOUR LEGS
TAIL
33 Fish Y N 1 Y Y N N 
FINS
43 CAR Y N S Y Y N N 
WHEELS
DOORS
TRAVEL

File 2:

FLAG1 SetA
FLAG7 SetB
FLAG10 SetC
FLAG9 SetD

I'd like to somewhat merge the files so that my final output is the following:

21 Cat Y N 1 Y Y N N FLAG1 SetA
FOUR LEGS
TAIL
WHISKERS
30 Dog N N 1 Y Y N N FLAG7 SetB
FOUR LEGS
TAIL
33 Fish Y N S Y Y N N FLAG10 SetC
FINS
43 CAR Y N S Y Y N N FLAG9 SetD
WHEELS
DOORS
TRAVEL

To do this, I believe that I should search for the following keyword "Y Y N N " and iterate through file2 to paste the flag & set id, but I'm not quite sure how I can do this. Any help would be greatly appreciated.

nawk 'FNR==NR{f2[FNR]=$0;next}{print $0 (($1~/[0-9]+/)?OFS f2[++c]:"")}' file2 file1

thanks for the edit. Quick question though, where in the code is it looking for the keyword "Y Y N N"? When I run the code, the files merge, but the (byte) position does not remain intact. For instance, in some cases, the FLAGS showed appread in column 51, when they should all start at column 80.

Not quite sure what is going on in your code? Could you please elaborate?

I'm not looking for 'Y Y N N'. I'm looking for lines in file1 where the first field is numeric:

21 Cat Y N S Y Y N N
FOUR LEGS
TAIL
WHISKERS
30 Dog N N 1 Y Y N N
FOUR LEGS
TAIL
33 Fish Y N 1 Y Y N N
FINS
43 CAR Y N S Y Y N N
WHEELS
DOORS
TRAVEL

This is the piece of code that performs that check:

$1~/[0-9]+/

I should probably tighten it up a bit more:

nawk 'FNR==NR{f2[FNR]=$0;next}{print $0 (($1~/^[0-9]+$/)?OFS f2[++c]:"")}' file2 file1

very clever!! But what can I do if i get the following entry?

99 Man Y N S Y Y N N
2 Hands
2 Feet

Then my 'clever' assumption is not clever no more and we need to identify the 'line' by some other means. Did you say the pattern 'Y Y N N'? It's not going to appear in any other lines? It doesn't matter where it appears on a line?

nawk -v p='Y Y N N' 'FNR==NR{f2[FNR]=$0;next}{print $0 (($0~p)?OFS f2[++c]:"")}' file2 file1

Yes, Y N N is shown on all of the main categories. When i tried the code you provided, it seems to have copied extra info. I think i can use notepad++ to remove some of this.

It worked with the sample file you provided under AiX.
If you're copying/ftp-ing files from Window$ to UNIX, make sure you don't have the trailing ^M-s on UNIX. To remove the trailing ^M-s on UNIX, do:

tr -d '\015' < windowsFile > unixFile