I have a large file (150K+ lines) containing DNS records, I'll call that FileA. I have a smaller file containing certain names, FileB. I want to delete all lines in FileA that end with what's in FileB. But I do not want to delete the line if the name appears at the beginning of the record.
I know how to use
grep -v name$ to manually remove the names that appear at the end of the record, but I need a loop to go through the whole FileB. So far my attempts have failed.
Here's an example I hope illustrates what I'm after:
FileA: hosta IN A 10.20.30.40 hostb IN A 22.214.171.124 myurl IN CNAME hostb yours IN CNAME hostb
If FileB contains hostb, only the last two lines are deleted; the first two lines are left as is.