sed 错误:未终止的“s"命令 [英] sed error: unterminated 's' command

查看:267
本文介绍了sed 错误:未终止的“s"命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 sed 命令下运行

I run below sed command

sed -i s/abc=.*$/abc=def ghi/g hpq_sf_attach_wf_param.txt

它给了我错误:

sed: -e expression #1, char 17: unterminated `s' command

我注意到这是由于 defghi 之间的空间造成的.知道如何修复它吗?

I noticed it is due to space in between of def and ghi. Any idea how to fix it?

推荐答案

您需要使用引号来保护特殊字符,包括空格、$*.

You need to use quoting to protect special characters, including spaces, $, and *.

sed -i 's/abc=.*$/abc=def ghi/g' hpq_sf_attach_wf_param.txt

这篇关于sed 错误:未终止的“s"命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆