I have a file with a name words.txtcontaining a list of words. I also have a file named file.txtcontaining a sentence per line. I need to quickly remove any lines in file.txtthat contain one of the lines from words.txt, but only if a match is found somewhere between {and }.
eg. file.txt:
Once upon a time there was a cat.
{The cat} lived in the forest.
The {cat really liked to} eat mice.
eg. words.txt:
cat
mice
Output Example:
Once upon a time there was a cat.
It is deleted because "cat" is on these two lines, and the words are also between {and }.
The following script successfully completes this task:
while read -r line
do
sed -i "/{.*$line.*}/d" file.txt
done < words.txt
script . words.txt , while . sed -f, , , , , , .
script?