Delete lines starting with XX or YY or ZZ or ....

Hi There!

My final task for today is to delete lines starting with certain numbers

for e.g., my text block is

and i want to delete all lines starting with 11 or 17 or 21

I know i can use multiple sed commands like

sed '/^11,/d' <filename>
sed '/^17,/d' <filename>
sed '/^21,/d' <filename>

but is there any way of doing this in one sed command?

for e.g. sed '/[1]/d' <filename>

Thanks again!


  1. 11|17|21 ↩︎

sed '/^1[17],/d;/^21,/d' filename

Or with grep:

egrep -v '^(1[17]|21),' filename