The sed command can be used to remove lines containing a keyword.
Remove line containing string from standard input:
$ echo -e "1\n2\n3"1
2
3
$ echo -e "1\n2\n3" | sed "/2/d"1
3
Remove line containing string from a file:
$ echo -e "1\n2\n3" > myfile.txt$ cat myfile.txt1
2
3
$ sed -i "" "/2/d" myfile.txt$ cat myfile.txt1
3
Posted May 20, 2021.
https://www.darklaunch.com/2021/05/20/use-sed-to-remove-line-containing-a-string.html