Tried couple of answers from similar questions but not quite getting correct results. Trying to search second file for variable and replace with second variable if there, otherwise keep original...

File1.txt

```
a
2
c
4
e
f

```

File2.txt

```
2 b
4 d

```

Wanted Output.txt

```
a
b
c
d
e
f

```

So far what I have seems to sort of work, but anywhere the replacement is happening I'm getting a blank row instead of the new variable...
Current Output.txt

```
a

c

e
f

```

Curent code....

```
awk -F'\t' 'NR==FNR{a[$1]=$2;next} {print (($1 in a) ? a[$1] : $1)}' file2.txt file1.txt > output.txt

```

Also tried and got same results...

```
awk -F'\t' 'NR==FNR{a[$1]=$2;next} {$1 = a[$1]}1' file2.txt file1.txt > output.txt 

```

Sorry first wrote incorrectly..fixed the key value issue.

Did try what you did, still not getting missing in output.txt

```
awk -F'\t' 'NR==FNR{a[$1]=$2;next} $1 in a{$1 = a[$1]}1' file2.txt file1.txt > output.txt

```