I have a list of names like so:
dog_bone
dog_collar
dragon
cool_dragon
lion
lion_trainer
dog
I need to extract out names that appear in other names like so:
dragon
lion
dog
I looked through the uniq man page, but it seems to compare entire lines, not strings. Is there a way to do this with a bash function?