Created
June 27, 2012 20:00
-
-
Save Maniacal/3006472 to your computer and use it in GitHub Desktop.
Problem with awk command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is what I have in my recipe: | |
bash "Set newrelic java options" do | |
user "root" | |
group "root" | |
cwd glassfishconfig | |
code <<-EOH | |
awk -v searchterm="<java-config" -v payload=" <jvm-options>-javaagent:#{newrelic_dir}/newrelic-#{node[:newrelic][:version]}/newrelic.jar</jvm-options>\n <jvm-options>-Dnewrelic.config.file=#{newrelic_dir}/#{node[:app][:key]}/newrelic.yml</jvm-options>\n <jvm-options>-Dnewrelic.config.log_file_path=#{newrelic_dir}/#{node[:app][:key]}/logs</jvm-options>" '{ if ($0 ~ searchterm) print $0 "\n" payload; else print $0 }' domain.xml.newrelic.bak > domain.xml | |
EOH | |
action :nothing | |
end | |
When that runs in the chef run I get this: | |
---- Begin output of "bash" "/tmp/chef-script20120627-8350-r7jiup" ---- | |
STDOUT: | |
STDERR: awk: { if ($0 ~ searchterm) print $0 " | |
awk: ^ unterminated string | |
---- End output of "bash" "/tmp/chef-script20120627-8350-r7jiup" ---- | |
But if I run that awk command from the command line it works fine. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment