如何在sed中表示行的开头和结尾

use*_*654 0 sed search regular-expression replace files

我想使用 sed'}将行尾的所有内容替换为"}. 我写:

sed -i -e "s/'}$/\"}$/g"
Run Code Online (Sandbox Code Playgroud)

但这将其替换为:"}$。怎么了?如何在我的 sed 中使用正则表达式来表达行的开头和结尾使用^$

Ste*_*itt 5

只有搜索表达式是正则表达式,替换文本不是:

sed -i -e "s/'}$/\"}/g"
Run Code Online (Sandbox Code Playgroud)

'}在一行的末尾匹配,并将其替换为"}.