【问题标题】:sed: sed: -e expression #1, char 63: unterminated `s' commandsed: sed: -e expression #1, char 63: unterminated `s' command
【发布时间】:2012-05-29 05:10:21
【问题描述】:

我正在尝试使用 sed 替换文本,但遇到以下错误:

[root@server3 ~]# echo "{"playlist":[" | sed 's#{"playlist":[#{"playlist":[{"comment":" text 1","playlist":[#'
sed: -e expression #1, char 63: unterminated `s' command

【问题讨论】:

    标签: linux bash unix ubuntu sed


    【解决方案1】:

    您需要对模式中的[ 进行转义,这样 sed 才不会认为您正在尝试启动字符列表。

    echo "test" | sed 's#{"playlist":\[#{"playlist":[{"comment":" text 1","playlist":[#'
    

    【讨论】:

    • 这正是问题所在。谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-02
    • 2013-03-08
    • 2021-02-07
    • 2020-11-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多