There are 3 files - master list and lists of what are pets and what are birds. Use grep to select from the master file (fileg.txt), making two files, that are then paste'd together.
\tmp>cat fileg.txt
cat
dog
sparrow
robin
snake
pigeon
\tmp>cat fileb.txt
sparrow
bluejay
robin
pigeon
eagle
hawk
\tmp>cat filep.txt
hamster
cat
dog
turtle
snake
\tmp>grep -f filep.txt <fileg.txt >fileg1.txt
\tmp>grep -f fileb.txt <fileg.txt >fileg2.txt
\tmp>paste fileg1.txt fileg2.txt
cat sparrow
dog robin
snake pigeon