It appears that you are using a Perl-compatible Regular Expression (PCRE) with
sed utility only knows Basic Regular Expressions (BRE) by default (or Extended Regular Expressions (ERE) when used with
-E on most systems).
I also don't think that the
sed syntax is correct, but it's difficult to read because the expression in the question seems to have extra
* in them. You appear to want to strip out the multipart divider in an email message, but you don't seem to care about matching these up correctly (matching a start of one multipart part to the corresponding end divider). If the
sed syntax was corrected, the expression would likely delete the full contents of the emails, or combine all attachments into the body of the message.
The PCRE expression
is the same as the ERE (to be used with
and using this with
d (which you appear to be doing) to would delete those lines, but the trailing
/ /g in your
sed command is an error. Removing
/ /g would likely have the effect of combining all attachments into the body of the email.
If you want to strip attachments of email messages (as indicated in comments), I would not try to do it with
sed but with a proper email message parser.
Examples of how to go about doing this may be found in the following related questions:
Personally, I would write a Perl script similar to the one in the first linked question/answer above. Just remember to always run test runs of such scripts on copies of you mailboxes, just in case you make mistakes.
fdm mail tool is able to filter messages based on the number and/or size of attachments, which may be handy as a way of filtering out large email messages from archived mailboxes.