PROBLEM:
I'm writing a script to configure Debian installs..... I need to comment out the line in sources.list for the DVD, I'm trying to use sed, I know how to delete the line or lines but I want to comment it out instead.
What I have is this:
sed -i '/deb cdrom:[Debian GNU/Linux 9.4.0 _S/s/^/#/' /etc/apt/sources.list
but it gives this error:
sed: -e expression #1, char 44: unterminated address regex
I'm guessing that it's the bracket that is the trouble.
QUESTION:
What is the trouble here and how do you fix the command and/or is there some other way of doing this?
Try this,
sed -i '/deb cdrom:\[Debian GNU\/Linux 9\.4\.0 _S/s/^/#/' /etc/apt/sources.list
[
, /
and .
in the search pattern, /
because it's the delimiter, and [
and .
because they are regexp operators.Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments