[英]Using sed to replace \ characters in file
I've got a file containing something like this: 我有一个包含以下内容的文件:
command_command2="value" command3="\\value\value2"
I need to replace all \\ with . 我需要用替换所有\\。
When using sed: 使用sed时:
sed -i 's/\/./g' $old > $new
i get an error message: 我收到一条错误消息:
- sed: -e expression #1, char 7: unterminated `s' command
Any leads? 有线索吗?
Here is an example that works. 这是一个有效的示例。 You can use |
您可以使用|
as well. 也一样 Less confusing than /
in this case. 在这种情况下,混淆不如/
。
line="command_command2=\"value\" command3=\"\\value\value2\""
]$ echo $line | sed 's|\\|.|g'
command_command2="value" command3=".value.value2"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.