【问题标题】:sed string with special character New带有特殊字符的 sed 字符串 New
【发布时间】:2015-06-15 19:21:11
【问题描述】:

当我使用这个脚本替换时:

mrm.fr.mycompany.com by 10.70.89.40:8081/artifactory


sed -i -e "s/mrm.fr.mycompany.com/10.70.89.40:8081/artifactory/g" config.xml

我有错误:

 sed: -e expression n°1, caractère 41: option inconnue pour `s'

谁能帮帮我 提前致谢

注意, 优素福

【问题讨论】:

    标签: linux sed special-characters


    【解决方案1】:

    使用\ 转义/:

    sed -i 's/mrm.fr.mycompany.com/10.70.89.40:8081\/artifactory/' config.xml
    

    或者使用这个:

    sed -i 's|mrm.fr.mycompany.com|10.70.89.40:8081/artifactory|' config.xml
    

    【讨论】:

    • 非常感谢赛勒斯
    猜你喜欢
    • 2017-05-05
    • 2018-11-14
    • 1970-01-01
    • 1970-01-01
    • 2018-07-02
    • 2021-11-17
    • 1970-01-01
    相关资源
    最近更新 更多