{"id":41,"date":"2013-01-08T08:44:00","date_gmt":"2013-01-08T08:44:00","guid":{"rendered":"https:\/\/www.root42.de\/blog\/?p=41"},"modified":"2013-01-08T08:44:00","modified_gmt":"2013-01-08T08:44:00","slug":"quoting-a-set-of-parameters-for-program-arguments-using-sed","status":"publish","type":"post","link":"https:\/\/www.root42.de\/blog\/?p=41","title":{"rendered":"Quoting a set of parameters for program arguments using sed"},"content":{"rendered":"<p>I have a script which launches another program. That program takes <a href=\"http:\/\/en.wikipedia.org\/w\/index.php?title=Command-line_interface&amp;oldid=530678628#Command-line_option\">some command line arguments<\/a>, which in turn can have parameters. Those parameters may include &#8220;;&#8221;, which has a special meaning in the Bash. To quote these, you can use the following sed command: <\/p>\n<pre>$ echo \"foo --bar=1 --baz=2\" | sed -e 's\/(--[^[:space:]]*=)([^[:space:]]*)\/1\"2\"\/g'<br \/>foo --bar=\"1\" --baz=\"2\"<br \/><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I have a script which launches another program. That program takes some command line arguments, which in turn can have parameters. Those parameters may include &#8220;;&#8221;, which has a special meaning in the Bash. To quote these, you can use the following sed command: $ echo &#8220;foo &#8211;bar=1 &#8211;baz=2&#8243; | sed -e &#8216;s\/(&#8211;[^[:space:]]*=)([^[:space:]]*)\/1&#8243;2&#8243;\/g&#8217;foo &#8211;bar=&#8221;1&#8243; &#8211;baz=&#8221;2&#8221;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[27,32,10],"tags":[],"_links":{"self":[{"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/41"}],"collection":[{"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=41"}],"version-history":[{"count":0,"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/41\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=41"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=41"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=41"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}