注释/注释与sed一致

时间:2019-01-20 20:02:03

标签: linux sed

在我的nginx配置文件中,有以下几行:

location / {
        try_files $uri $uri/ =404;
        auth_basic "Restricted Content";
        auth_basic_user_file /etc/nginx/.htpasswd;
    }

现在,我想以编程方式注释掉/取消注释这两行:

        auth_basic "Restricted Content";
        auth_basic_user_file /etc/nginx/.htpasswd;

所以我想到了sed,并在这里找到了这篇文章: https://stackoverflow.com/a/27355109

很遗憾,我无法使它正常工作。逃逸字符可能存在问题。有人可以帮忙吗?

1 个答案:

答案 0 :(得分:2)

要注释掉这些行,请使用命令

next

要取消注释,请使用此:

to
相关问题