In sed
regexps you have to escape (
, |
, and )
.
You also need to use the g
modifier so it replaces all matches on the line, not just the first match.
dellist="package24|package66"
# escape the pipes
dellist=${dellist//|/\|}
sed "s/($dellist)//g" benoietigte_packete.list
I've added the
so it only matches whole words.
Depending on the version of sed
you have, you can also use the -E
or -r
options to use extended regular expressions.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…