1

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

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

1 回答 1

4

您需要[在模式中转义,因此 sed 不会认为您正在尝试启动字符列表。

echo "test" | sed 's#{"playlist":\[#{"playlist":[{"comment":" text 1","playlist":[#'
于 2012-05-22T17:04:11.490 回答