我想替换XML文件中的值.示例XML
<Console>
<!-- REQUIRED PARAMETERS -->
<!-- Enter the node that you are running the installation program from. This value must be a fully qualified name, which includes a host name and domain name. For example, node001.server.name.com.-->
<node>node.sample.ibm.com</node>
<!-- Enter the domain name of the cluster as a single dot-separated string. For example, server.name.com. -->
<sso-domain-name>sample.ibm.com</sso-domain-name>
<!-- Set this property to true if your InfoSphere BigInsights Console uses HTTPS. Otherwise, enter false. -->
<https>false</https>
<!-- management-console-port specifies which port is …Run Code Online (Sandbox Code Playgroud) 嗨,我在厨师食谱中使用sed命令,但它抛出错误。但是,如果我在CLI上仅运行sed命令,它就可以工作。任何帮助表示赞赏。
我的sed命令是-
sed -i -e "/<BigSQL>/,/<\/BigSQL>/ s|<username>[0-9a-z.]\{1,\}</username>|<username>bigsql</username>|" /home/biadmin/install.xml
Run Code Online (Sandbox Code Playgroud)
我的厨师食谱是-
bash "change_bigsqluser" do
user "root"
code <<-EOH
sed -i -e "/<BigSQL>/,/<\/BigSQL>/ s|<username>[0-9a-z.]\{1,\}</username>|<username>bigsql</username>|" /home/biadmin/install.xml
EOH
end
Run Code Online (Sandbox Code Playgroud)
这是错误
Error executing action `run` on resource 'bash[change_bigsqluser]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of "bash" "/tmp/chef-script20140807-4025602-160wvt2" ----
STDOUT:
STDERR: sed: -e expression #1, char 15: unknown command: `B'
---- End output of "bash" "/tmp/chef-script20140807-4025602-160wvt2" ----
Ran "bash" "/tmp/chef-script20140807-4025602-160wvt2" returned 1
Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/biginsights/recipes/temp.rb …Run Code Online (Sandbox Code Playgroud)