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?
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?
Why search and replace when you can delete?
sed --in-place '/^alias dwa=/d' /path/to/file
awk '!/alias dwa/{print $0}' filename
{print $0}
is wholly unnecessary
– n.caillou
Dec 01 '17 at 20:50