Dimitris Mintis Asked: 2019-08-14 01:43:03 +0800 CST2019-08-14 01:43:03 +0800 CST 2019-08-14 01:43:03 +0800 CST 用 sed 替换包含“\”字符的特定字符 772 我想用句子“ lw 2,\”替换下面的句子“ lw 2”但是我不能这样做 sed -i 's|lw 2,\|lw 2|g' "filname" 我收到以下错误 sed: -e expression #1, char 15: unterminated `s' command 好像不喜欢“ \” sed quoting 1 个回答 Voted Best Answer Paul Burrows 2019-08-14T01:45:59+08:002019-08-14T01:45:59+08:00 您只需要转义反斜杠: 's|lw 2,\\|lw 2|g'
您只需要转义反斜杠: