{"id":938,"date":"2016-02-05T15:44:25","date_gmt":"2016-02-05T10:44:25","guid":{"rendered":"http:\/\/alexeyka.zantsev.com\/?p=938"},"modified":"2016-02-05T15:48:39","modified_gmt":"2016-02-05T10:48:39","slug":"sed-add-line-starting-with-2-tabs-before-another-matching-line","status":"publish","type":"post","link":"https:\/\/alexeyka.zantsev.com\/?p=938","title":{"rendered":"sed: add line starting with 2 tabs before another matching line"},"content":{"rendered":"<p>Add a line <em>Sipaddheader(X-DSTPHONE:${E});<\/em> before lines containing <em>zabbix<\/em>.<\/p>\n<pre>sed '\/zabbix\/a Sipaddheader(X-DSTPHONE:${E});' extensions.ael > extensions2.ael<\/pre>\n<p>Add the same but starting with 2 tabs seems to be not hard. But the problem is that not all sed versions support \\t parameter.<\/p>\n<p>So, neither of these worked for me:<\/p>\n<pre>sed '\/zabbix\/a \\t\\tSipaddheader(X-DSTPHONE:${E});' extensions.ael > extensions2.ael<\/pre>\n<pre>sed '\/zabbix\/a \\t\\t Sipaddheader(X-DSTPHONE:${E});' extensions.ael > extensions2.ael<\/pre>\n<pre>sed '\/zabbix\/a\\t\\t Sipaddheader(X-DSTPHONE:${E});' extensions.ael > extensions2.ael<\/pre>\n<p>The solution is as follows: insert a literal tab pressing Ctrl-V and then Tab (not shown in the listing).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Add a line Sipaddheader(X-DSTPHONE:${E}); before lines containing zabbix. sed &#8216;\/zabbix\/a Sipaddheader(X-DSTPHONE:${E});&#8217; extensions.ael > extensions2.ael Add the same but starting with 2 tabs seems to be not hard. But the problem is that not all sed versions support \\t parameter. So, neither of these worked for me: sed &#8216;\/zabbix\/a \\t\\tSipaddheader(X-DSTPHONE:${E});&#8217; extensions.ael > extensions2.ael sed &#8216;\/zabbix\/a \\t\\t [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[209],"class_list":["post-938","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-sed"],"_links":{"self":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts\/938","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=938"}],"version-history":[{"count":3,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts\/938\/revisions"}],"predecessor-version":[{"id":941,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts\/938\/revisions\/941"}],"wp:attachment":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=938"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=938"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=938"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}