我正在尝试使用sed将文本插入文件的第三行,我在其他论坛上找到的语法是:
sed -i '' "3i\ text to insert" file
Run Code Online (Sandbox Code Playgroud)
但是,当我使用它时,我收到一个错误:
sed: 1: "3i\ text to insert": extra characters after \ at the end of i command
Run Code Online (Sandbox Code Playgroud)
我似乎无法弄清楚导致问题的原因.我正在使用OSX,这就是为什么我有一个空的''作为我的扩展.
谢谢!