Compare entries in two files, output one of them in bash

I have two files which are of the following format:

File1:
Unnamed
Unnamed
Boston
Unnamed
New_York
Unnamed

File2:
San_Francisco
Chicago
Portland
Austin
Orlando
Los_Angeles

In the case where an entry in File1 is "Unnamed", I want to output the name from the same line in File2. In the case where the entry in File1 is a name, then I want to output the name from File1.

I want the output to be a file, preferably into File 2, although having the output as File3 would be OK too.

I'm new to using bash, and I can't seem to figure out how to do this. Thanks.

nawk '
{ if ( FILENAME == "file1" ) _[FNR]=$0
  if ( FILENAME == "file2" && _[FNR] == "Unnamed" )  _[FNR]=$0
}
END { for ( i=1; i<= FNR; i++  ) print _ }
' file1 file2 > file3
nawk 'NR==FNR{_[FNR]=$0;next}{print ($0=="Unnamed")?_[FNR]:$0}' file2 file1 > file3
paste -d" " fiel1 file2| awk '{if ($1=="Unnamed"){print $2}else{print $1}}'

Hey all,

I appreciate the responses. I have tried each one and here is some feedback..

pmm: I also have variable names as my filenames in my script. For example:

nawk '
{ if ( FILENAME == "/files/temp/$1oldNames" ) _[FNR]=$0
  if ( FILENAME == "/files/temp/$1newNames" && _[FNR] == "Unnamed" )  _[FNR]=$0
}
END { for ( i=1; i<= FNR; i++  ) print _ }
' /files/temp/$1oldNames /files/temp/$1newNames > /files/temp/$1mergedNames

Even if I harcode the file names I get a blank file3.

rikxik: That just makes file3 just like file1

summer_cherry: This works great except I realized that in file1 and file2, not only does each line have a name, but it also has enough space characters so that each line is 15 characters long, and I need to preserve the spaces (so when I merge it with other data the columns are maintained), or add spaces out to 15 for each line in file3.

No, it doesn't on my Solaris box:

$ cat file1
Unnamed
Unnamed
Boston
Unnamed
New_York
Unnamed
$
$ cat file2
San_Francisco
Chicago
Portland
Austin
Orlando
Los_Angeles
$
$ nawk 'NR==FNR{_[FNR]=$0;next}{print ($0=="Unnamed")?_[FNR]:$0}' file2 file1
San_Francisco
Chicago
Boston
Austin
New_York
Los_Angeles