我尝试在匹配模式后替换 2 行字符。为此,我正在使用此代码:
sed '/some_pattern/{N;N;s/word1/word2/}' /etc/filesystems > /etc/filesystems.tmp && mv -f /etc/filesystems.tmp /etc/filesystems
Run Code Online (Sandbox Code Playgroud)
我测试了这个命令并确认它在 Linux 上运行良好。但是,当我在 AIX 中使用它时,我收到如下错误消息:
sed: Function /some_pattern/{N;N;s/word1/word2/} cannot be parsed.
Run Code Online (Sandbox Code Playgroud)
任何的想法?