Artificial intelligent assistant

How to find and replace using sed text containing a star * I would like to find and replace text within many `.procmailrc` files, and using `grep` and `sed`. I would like to remove the following line (including the new line break at the beginning) from the `.procmailrc` files: * !^FROM_MAILER The full contents of the file I want changed from: :0 * !^FROM_MAILER ! myemail@email.com to: :0 ! myemail@email.com The command I am running is: grep -lir '\n* !^FROM_MAILER' .procmailrc | xargs sed -i 's/\n* !^FROM_MAILER//g' But it is not replacing the `*`. In leaves the line in with just the `*` on it. If I escape the `*` as follows, that also does not work: grep -lir '\n\* !^FROM_MAILER' .procmailrc | xargs sed -i 's/\n\* !^FROM_MAILER//g' So I trying to find out how to do the find and replace to remove the entire line with the `*` in it.

With `sed` alone:


sed -i '/^* !^FROM_MAILER$/d' file


To remove the whole line containing the exact string `* !^FROM_MAILER`, with nothing before and after that string. The `d` command deletes the line.

* * *

**Edit** : If you want to do the replace in all files recusively, use the following:


find /path -type f -exec sed -i '/^* !^FROM_MAILER$/d' {} +

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 0ce0ada4c797b414aadf0f6aaada87a4