delete lines with sed match a special regex

match, regex, sed

Solution

Use this sed command:

sed -i.old '/^[#*-]\{0,1\}blubb/d' special.conf

OR

sed -i.old -E '/^[#*-]?blubb/d' special.conf

OR

sed -i.old -r '/^[#*-]?blubb/d' special.conf

Problem

I try to delete all lines that begin with some optional special chars followed by `blubb`: That's the lines I want to match: #blubb *blubb -blubb blubb That should do it, but doesn't work :( ``` sed "/^.?blubb$/d" -i special.conf sed "/^[#*-]?blubb$/d" -i special.conf ``` Has somebody the right solution?

Original source