I have a file (email) containing email addresses.
I have a second file (terms) that contains simple regular expressions and words/characters. Here are some examples:
\.trainee
\.group
\.web
I want to go through email and delete lines containing the expressions/words from terms and write to a new file - newemail.
So I thought I would use sed in a shell script. Here is what I tried.
#!/bin/bash
for x in `cat /usr/local/terms`
do
sed '/"$x"/d' email > newemail
done
When I run the above, all I get is a cat of the complete email file. I am thinking that I am missing some punctuation or delimiter or this can't be done with sed inside a script.