Michael003
Michael003

Reputation: 442

Sed - strict matching

I want my sed to delete only what I give him.

For exemple, I have this

sed -ie "/$1/d" /etc/asterisk/voicemail.conf &>/dev/null

In the case where my voicemail.conf has some strings like "hello" and "helloc", if my $1 is "hello" that will also remove the line that contains "helloc"

Upvotes: 0

Views: 133

Answers (1)

romaric crailox
romaric crailox

Reputation: 584

Try to use \b that corresponds to the limit of a word :

sed -ie "/\b$1\b/d" /etc/asterisk/voicemail.conf &>/dev/null

Upvotes: 3

Related Questions