0

I have this text in /etc/bash.bashrc:

alias dwa='bash /opt/dwa.sh'

I tried to delete it with the following (and similar commands):

sed -i 'alias dwa=\'bash /opt/dwa.sh\'/d' /etc/bash.bashrc

Why did my sed operation fail?

Philip Kirkbride
  • 9,816
  • 25
  • 95
  • 167
Arcticooling
  • 1
  • 12
  • 44
  • 103

2 Answers2

1

Why search and replace when you can delete?

sed --in-place '/^alias dwa=/d' /path/to/file
DopeGhoti
  • 73,792
  • 8
  • 97
  • 133
-2
awk '!/alias dwa/{print $0}' filename
grg
  • 197
  • 7
Praveen Kumar BS
  • 5,139
  • 2
  • 9
  • 14