{"id":715,"date":"2012-03-23T03:11:30","date_gmt":"2012-03-23T08:11:30","guid":{"rendered":"https:\/\/www.bodhost.com\/blog\/?p=715"},"modified":"2026-02-26T13:59:05","modified_gmt":"2026-02-26T13:59:05","slug":"uses-of-sed-substitution-in-unix-server","status":"publish","type":"post","link":"https:\/\/www.bodhost.com\/blog\/uses-of-sed-substitution-in-unix-server\/","title":{"rendered":"Uses Of Sed Substitution In Unix Server"},"content":{"rendered":"\r\n<p class=\"wp-block-paragraph\">In this article, let us review some interesting workarounds with the \u201cs\u201d substitute command in sed with several practical examples.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><strong>I. Sed Substitution Delimiter<\/strong><\/h3>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">In the sed substitute command, users can use different delimiters like, @ % | ; :<\/p>\r\n\r\n\r\n<div class=\"wp-block-image\">\r\n<figure class=\"alignright\"><img loading=\"lazy\" decoding=\"async\" width=\"400\" height=\"300\" class=\"wp-image-724\" title=\"unix-linux\" src=\"https:\/\/www.bodhost.com\/blog\/wp-content\/uploads\/2012\/03\/unix-linux1.jpg\" alt=\"\" srcset=\"https:\/\/www.bodhost.com\/blog\/wp-content\/uploads\/2012\/03\/unix-linux1.jpg 400w, https:\/\/www.bodhost.com\/blog\/wp-content\/uploads\/2012\/03\/unix-linux1-300x225.jpg 300w\" sizes=\"auto, (max-width: 400px) 100vw, 400px\" \/><\/figure>\r\n<\/div>\r\n\r\n\r\n<p class=\"wp-block-paragraph\">We first need to create the path.txt file which is used in all the given examples<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">$ cat path.txt\r\n\/usr\/kbos\/bin:\/usr\/local\/bin:\/usr\/jbin:\/usr\/bin:\/usr\/sas\/bin\r\n\/usr\/local\/sbin:\/sbin:\/bin\/:\/usr\/sbin:\/usr\/bin:\/opt\/omni\/bin:\r\n\/opt\/omni\/lbin:\/opt\/omni\/sbin:\/root\/bin\r\n\r\n<\/pre>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\"><strong>Example 1 \u2013 sed @ delimiter: Substitute \/opt\/omni\/lbin to \/opt\/tools\/bin<\/strong><\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">If you substitute a path as \u2018\/\u2019 and you can use @ as a delimiter instead of \u2018\/\u2019. In the sed example below, in the last line of the input file, \/opt\/omni\/lbin was changed to \/opt\/tools\/bin.<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">$ sed 's@\/opt\/omni\/lbin@\/opt\/tools\/bin@g' path.txt\r\n\/usr\/kbos\/bin:\/usr\/local\/bin:\/usr\/jbin\/:\/usr\/bin:\/usr\/sas\/bin\r\n\/usr\/local\/sbin:\/sbin:\/bin\/:\/usr\/sbin:\/usr\/bin:\/opt\/omni\/bin:\r\n<strong>\/opt\/tools\/bin<\/strong>:\/opt\/omni\/sbin:\/root\/bin<\/pre>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\"><strong>Example 2 \u2013 sed \/ delimiter: Substitute \/opt\/omni\/lbin to \/opt\/tools\/bin<\/strong><\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">When you should use \u2018\/\u2019 in path name-related substitution, you have to escape \u2018\/\u2019 in the substitution data as shown below. In this sed example, the delimiter \u2018\/\u2019 was escaped in the REGEXP and REPLACEMENT part.<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">$ sed 's\/\\\/opt\\\/omni\\\/lbin\/\\\/opt\\\/tools\\\/bin\/g' path.txt\r\n\/usr\/kbos\/bin:\/usr\/local\/bin:\/usr\/jbin\/:\/usr\/bin:\/usr\/sas\/bin\r\n\/usr\/local\/sbin:\/sbin:\/bin\/:\/usr\/sbin:\/usr\/bin:\/opt\/omni\/bin:\r\n<strong>\/opt\/tools\/bin<\/strong>:\/opt\/omni\/sbin:\/root\/bin\r\n<\/pre>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><strong>II. Sed \u2018&amp;\u2019 Get Matched String<\/strong><\/h3>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">The precise part of an input line on which the Regular Expression matches is represented by &amp;, which can then be used in the replacement part.<\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\"><strong>Example 1 \u2013 sed &amp; Usage: Substitute \/usr\/bin\/ to \/usr\/bin\/local<\/strong><\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">$ sed 's@\/usr\/bin@&amp;\/local@g' path.txt\r\n\/usr\/kbos\/bin:\/usr\/local\/bin:\/usr\/jbin\/:<strong>\/usr\/bin\/local<\/strong>:\/usr\/sas\/bin\r\n\/usr\/local\/sbin:\/sbin:\/bin\/:\/usr\/sbin:<strong>\/usr\/bin\/local<\/strong>:\/opt\/omni\/bin:\r\n\/opt\/omni\/lbin:\/opt\/omni\/sbin:\/root\/bin<\/pre>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">In the above example \u2018&amp;\u2019 in the replacement part will replace with \/usr\/bin which is matched pattern and add it with \/local. So in the output all the occurrence of \/usr\/bin will be replaced with \/usr\/bin\/local<\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\"><strong>Example 2 \u2013 sed &amp; Usage: Match the whole line<\/strong><\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">&amp; replaces whatever matches with the given REGEXP.<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">$ sed 's@^.*$@&lt;&lt;&lt;&amp;&gt;&gt;&gt;@g' path.txt\r\n&lt;&lt;&lt;\/usr\/kbos\/bin:\/usr\/local\/bin:\/usr\/jbin\/:\/usr\/bin:\/usr\/sas\/bin&gt;&gt;&gt;\r\n&lt;&lt;&lt;\/usr\/local\/sbin:\/sbin:\/bin\/:\/usr\/sbin:\/usr\/bin:\/opt\/omni\/bin:&gt;&gt;&gt;\r\n&lt;&lt;&lt;\/opt\/omni\/lbin:\/opt\/omni\/sbin:\/root\/bin&gt;&gt;&gt;<\/pre>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">In the above example regexp has \u201c^.*$\u201d which matches the whole line. Replacement part &lt;&lt;&lt;&amp;&gt;&gt;&gt; writes the whole line with &lt;&lt;&lt; and &gt;&gt;&gt; in the beginning and end of the line respectively.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><strong>III. Grouping and Back-references in Sed<\/strong><\/h3>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">Grouping can be used in sed like normal regular expression. A group is opened with \u201c\\(\u201d and closed with \u201c\\)\u201d.Grouping can be used in combination with back-referencing.<\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">Back-reference is the re-use of a part of a Regular Expression selected by grouping. Back-references in sed can be used in both a Regular Expression and in the replacement part of the substitute command.<\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\"><strong>Example 1: Get only the first path in each line<\/strong><\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">$ sed 's\/\\(\\\/[^:]*\\).*\/\\1\/g' path.txt\r\n\/usr\/kbos\/bin\r\n\/usr\/local\/sbin\r\n\/opt\/omni\/lbin<\/pre>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">In the above example, \\(\\\/[^:]*\\) matches the path available before first: comes. \\1 replaces the first matched group.<\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\"><strong>Example 2: multi grouping<\/strong><\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">In the file path.txt change the order of field in the last line of the file.<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">$ sed '$s@\\([^:]*\\):\\([^:]*\\):\\([^:]*\\)@\\3:\\2:\\1@g' path.txt\r\n\/usr\/kbos\/bin:\/usr\/local\/bin:\/usr\/jbin:\/usr\/bin:\/usr\/sas\/bin\r\n\/usr\/local\/sbin:\/sbin:\/bin:\/usr\/sbin:\/usr\/bin:\/opt\/omni\/bin:\r\n<strong>\/root\/bin:\/opt\/omni\/sbin:\/opt\/omni\/lbin<\/strong><\/pre>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">In the above command, $ specifies substitution to happen only for the last line. The output shows that the order of the path values in the last line has been reversed.<\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\"><strong>Example 3: Get the list of usernames in \/etc\/passwd file<\/strong><\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">This sed example displays only the first field from the \/etc\/passwd file.<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">$sed 's\/\\([^:]*\\).*\/\\1\/' \/etc\/passwd\r\nroot\r\nbin\r\ndaemon\r\nadm\r\nlp\r\nsync\r\nshutdown<\/pre>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\"><strong>Example 4: Parenthesize first character of each word<\/strong><\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">This sed example prints the first character of every word in parenthesis.<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">$ echo \"Welcome To The Geek Stuff\" | sed 's\/\\(\\b[A-Z]\\)\/\\(\\1\\)\/g'\r\n(W)elcome (T)o (T)he (G)eek (S)tuff<\/pre>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\"><strong>Example 5: Commify the simple number.<\/strong><\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">Let us create a file called numbers which has a list of numbers. The below sed command example is used to commify the numbers to thousands.<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">$ cat  numbers\r\n1234\r\n12121\r\n3434\r\n123\r\n\r\n$sed 's\/\\(^\\|[^0-9.]\\)\\([0-9]\\+\\)\\([0-9]\\{3\\}\\)\/\\1\\2,\\3\/g' numbers\r\n1,234\r\n12,121\r\n3,434\r\n123<\/pre>\r\n","protected":false},"excerpt":{"rendered":"<p>In this article, let us review some interesting workarounds with the \u201cs\u201d substitute command in sed with several practical examples. I. Sed Substitution Delimiter In the sed substitute command, users&hellip;<\/p>\n<p><a href=\"https:\/\/www.bodhost.com\/blog\/uses-of-sed-substitution-in-unix-server\/\" class=\"more-link\">Read More<\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[149,3],"tags":[170,171,169],"class_list":["post-715","post","type-post","status-publish","format-standard","hentry","category-linux","category-web-hosting","tag-sed-substitution","tag-substitute-command-in-sed","tag-unix-server"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.8 - aioseo.com -->\n\t<meta name=\"description\" content=\"In this article, let us review some interesting workarounds with the \u201cs\u201d substitute command in sed with several practical examples.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Admin1\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.bodhost.com\/blog\/uses-of-sed-substitution-in-unix-server\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.8\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"bodHOST | Web Hosting - Tips &amp; Tricks\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Uses Of Sed Substitution In Unix Server | bodHOST\" \/>\n\t\t<meta property=\"og:description\" content=\"In this article, let us review some interesting workarounds with the \u201cs\u201d substitute command in sed with several practical examples.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.bodhost.com\/blog\/uses-of-sed-substitution-in-unix-server\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/www.bodhost.com\/blog\/wp-content\/uploads\/2026\/03\/cropped-Profile-Pic.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/www.bodhost.com\/blog\/wp-content\/uploads\/2026\/03\/cropped-Profile-Pic.png\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2012-03-23T08:11:30+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-02-26T13:59:05+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Uses Of Sed Substitution In Unix Server | bodHOST\" \/>\n\t\t<meta name=\"twitter:description\" content=\"In this article, let us review some interesting workarounds with the \u201cs\u201d substitute command in sed with several practical examples.\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.bodhost.com\/blog\/wp-content\/uploads\/2026\/03\/cropped-Profile-Pic.png\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/blog\\\/uses-of-sed-substitution-in-unix-server\\\/#article\",\"name\":\"Uses Of Sed Substitution In Unix Server | bodHOST\",\"headline\":\"Uses Of Sed Substitution In Unix Server\",\"author\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/blog\\\/author\\\/admin1\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/blog\\\/wp-content\\\/uploads\\\/2012\\\/03\\\/unix-linux1.jpg\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/blog\\\/uses-of-sed-substitution-in-unix-server\\\/#articleImage\",\"width\":400,\"height\":300},\"datePublished\":\"2012-03-23T03:11:30+00:00\",\"dateModified\":\"2026-02-26T13:59:05+00:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/blog\\\/uses-of-sed-substitution-in-unix-server\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/blog\\\/uses-of-sed-substitution-in-unix-server\\\/#webpage\"},\"articleSection\":\"Linux, Web Hosting, Sed Substitution, substitute command in sed, Unix Server\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/blog\\\/uses-of-sed-substitution-in-unix-server\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.bodhost.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/blog\\\/category\\\/web-hosting\\\/#listItem\",\"name\":\"Web Hosting\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/blog\\\/category\\\/web-hosting\\\/#listItem\",\"position\":2,\"name\":\"Web Hosting\",\"item\":\"https:\\\/\\\/www.bodhost.com\\\/blog\\\/category\\\/web-hosting\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/blog\\\/uses-of-sed-substitution-in-unix-server\\\/#listItem\",\"name\":\"Uses Of Sed Substitution In Unix Server\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/blog\\\/uses-of-sed-substitution-in-unix-server\\\/#listItem\",\"position\":3,\"name\":\"Uses Of Sed Substitution In Unix Server\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/blog\\\/category\\\/web-hosting\\\/#listItem\",\"name\":\"Web Hosting\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/blog\\\/#organization\",\"name\":\"bodHOST\",\"description\":\"Web Hosting - Tips & Tricks\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/03\\\/cropped-Profile-Pic.png\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/blog\\\/uses-of-sed-substitution-in-unix-server\\\/#organizationLogo\",\"width\":96,\"height\":96,\"caption\":\"bodHOST\"},\"image\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/blog\\\/uses-of-sed-substitution-in-unix-server\\\/#organizationLogo\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/blog\\\/author\\\/admin1\\\/#author\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/blog\\\/author\\\/admin1\\\/\",\"name\":\"Admin1\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/blog\\\/uses-of-sed-substitution-in-unix-server\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cd7e35fa8b64889a49e442de56b8ca06e2b3916e7deb2c547281a07b793043b6?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Admin1\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/blog\\\/uses-of-sed-substitution-in-unix-server\\\/#webpage\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/blog\\\/uses-of-sed-substitution-in-unix-server\\\/\",\"name\":\"Uses Of Sed Substitution In Unix Server | bodHOST\",\"description\":\"In this article, let us review some interesting workarounds with the \\u201cs\\u201d substitute command in sed with several practical examples.\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/blog\\\/uses-of-sed-substitution-in-unix-server\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/blog\\\/author\\\/admin1\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/blog\\\/author\\\/admin1\\\/#author\"},\"datePublished\":\"2012-03-23T03:11:30+00:00\",\"dateModified\":\"2026-02-26T13:59:05+00:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/blog\\\/\",\"name\":\"bodHOST\",\"description\":\"Web Hosting - Tips & Tricks\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Uses Of Sed Substitution In Unix Server | bodHOST","description":"In this article, let us review some interesting workarounds with the \u201cs\u201d substitute command in sed with several practical examples.","canonical_url":"https:\/\/www.bodhost.com\/blog\/uses-of-sed-substitution-in-unix-server\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.bodhost.com\/blog\/uses-of-sed-substitution-in-unix-server\/#article","name":"Uses Of Sed Substitution In Unix Server | bodHOST","headline":"Uses Of Sed Substitution In Unix Server","author":{"@id":"https:\/\/www.bodhost.com\/blog\/author\/admin1\/#author"},"publisher":{"@id":"https:\/\/www.bodhost.com\/blog\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/www.bodhost.com\/blog\/wp-content\/uploads\/2012\/03\/unix-linux1.jpg","@id":"https:\/\/www.bodhost.com\/blog\/uses-of-sed-substitution-in-unix-server\/#articleImage","width":400,"height":300},"datePublished":"2012-03-23T03:11:30+00:00","dateModified":"2026-02-26T13:59:05+00:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/www.bodhost.com\/blog\/uses-of-sed-substitution-in-unix-server\/#webpage"},"isPartOf":{"@id":"https:\/\/www.bodhost.com\/blog\/uses-of-sed-substitution-in-unix-server\/#webpage"},"articleSection":"Linux, Web Hosting, Sed Substitution, substitute command in sed, Unix Server"},{"@type":"BreadcrumbList","@id":"https:\/\/www.bodhost.com\/blog\/uses-of-sed-substitution-in-unix-server\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.bodhost.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/www.bodhost.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/www.bodhost.com\/blog\/category\/web-hosting\/#listItem","name":"Web Hosting"}},{"@type":"ListItem","@id":"https:\/\/www.bodhost.com\/blog\/category\/web-hosting\/#listItem","position":2,"name":"Web Hosting","item":"https:\/\/www.bodhost.com\/blog\/category\/web-hosting\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.bodhost.com\/blog\/uses-of-sed-substitution-in-unix-server\/#listItem","name":"Uses Of Sed Substitution In Unix Server"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.bodhost.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/www.bodhost.com\/blog\/uses-of-sed-substitution-in-unix-server\/#listItem","position":3,"name":"Uses Of Sed Substitution In Unix Server","previousItem":{"@type":"ListItem","@id":"https:\/\/www.bodhost.com\/blog\/category\/web-hosting\/#listItem","name":"Web Hosting"}}]},{"@type":"Organization","@id":"https:\/\/www.bodhost.com\/blog\/#organization","name":"bodHOST","description":"Web Hosting - Tips & Tricks","url":"https:\/\/www.bodhost.com\/blog\/","logo":{"@type":"ImageObject","url":"https:\/\/www.bodhost.com\/blog\/wp-content\/uploads\/2026\/03\/cropped-Profile-Pic.png","@id":"https:\/\/www.bodhost.com\/blog\/uses-of-sed-substitution-in-unix-server\/#organizationLogo","width":96,"height":96,"caption":"bodHOST"},"image":{"@id":"https:\/\/www.bodhost.com\/blog\/uses-of-sed-substitution-in-unix-server\/#organizationLogo"}},{"@type":"Person","@id":"https:\/\/www.bodhost.com\/blog\/author\/admin1\/#author","url":"https:\/\/www.bodhost.com\/blog\/author\/admin1\/","name":"Admin1","image":{"@type":"ImageObject","@id":"https:\/\/www.bodhost.com\/blog\/uses-of-sed-substitution-in-unix-server\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/cd7e35fa8b64889a49e442de56b8ca06e2b3916e7deb2c547281a07b793043b6?s=96&d=mm&r=g","width":96,"height":96,"caption":"Admin1"}},{"@type":"WebPage","@id":"https:\/\/www.bodhost.com\/blog\/uses-of-sed-substitution-in-unix-server\/#webpage","url":"https:\/\/www.bodhost.com\/blog\/uses-of-sed-substitution-in-unix-server\/","name":"Uses Of Sed Substitution In Unix Server | bodHOST","description":"In this article, let us review some interesting workarounds with the \u201cs\u201d substitute command in sed with several practical examples.","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/www.bodhost.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/www.bodhost.com\/blog\/uses-of-sed-substitution-in-unix-server\/#breadcrumblist"},"author":{"@id":"https:\/\/www.bodhost.com\/blog\/author\/admin1\/#author"},"creator":{"@id":"https:\/\/www.bodhost.com\/blog\/author\/admin1\/#author"},"datePublished":"2012-03-23T03:11:30+00:00","dateModified":"2026-02-26T13:59:05+00:00"},{"@type":"WebSite","@id":"https:\/\/www.bodhost.com\/blog\/#website","url":"https:\/\/www.bodhost.com\/blog\/","name":"bodHOST","description":"Web Hosting - Tips & Tricks","inLanguage":"en-US","publisher":{"@id":"https:\/\/www.bodhost.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"bodHOST | Web Hosting - Tips &amp; Tricks","og:type":"article","og:title":"Uses Of Sed Substitution In Unix Server | bodHOST","og:description":"In this article, let us review some interesting workarounds with the \u201cs\u201d substitute command in sed with several practical examples.","og:url":"https:\/\/www.bodhost.com\/blog\/uses-of-sed-substitution-in-unix-server\/","og:image":"https:\/\/www.bodhost.com\/blog\/wp-content\/uploads\/2026\/03\/cropped-Profile-Pic.png","og:image:secure_url":"https:\/\/www.bodhost.com\/blog\/wp-content\/uploads\/2026\/03\/cropped-Profile-Pic.png","article:published_time":"2012-03-23T08:11:30+00:00","article:modified_time":"2026-02-26T13:59:05+00:00","twitter:card":"summary","twitter:title":"Uses Of Sed Substitution In Unix Server | bodHOST","twitter:description":"In this article, let us review some interesting workarounds with the \u201cs\u201d substitute command in sed with several practical examples.","twitter:image":"https:\/\/www.bodhost.com\/blog\/wp-content\/uploads\/2026\/03\/cropped-Profile-Pic.png"},"aioseo_meta_data":{"post_id":"715","title":null,"description":"In this article, let us review some interesting workarounds with the \u201cs\u201d substitute command in sed with several practical examples.","keywords":[],"keyphrases":{"focus":{"keyphrase":"Unix ","score":59,"analysis":{"keyphraseInTitle":{"score":9,"maxScore":9,"error":0},"keyphraseInDescription":{"score":3,"maxScore":9,"error":1},"keyphraseLength":{"score":9,"maxScore":9,"error":0,"length":1},"keyphraseInURL":{"score":5,"maxScore":5,"error":0},"keyphraseInIntroduction":{"score":3,"maxScore":9,"error":1},"keyphraseInSubHeadings":{"score":3,"maxScore":9,"error":1},"keyphraseInImageAlt":{"score":3,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":[],"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[],"defaultGraph":"","defaultPostTypeGraph":""},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2021-05-18 14:33:21","updated":"2026-02-27 09:33:40","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.bodhost.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.bodhost.com\/blog\/category\/web-hosting\/\" title=\"Web Hosting\">Web Hosting<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tUses Of Sed Substitution In Unix Server\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.bodhost.com\/blog"},{"label":"Web Hosting","link":"https:\/\/www.bodhost.com\/blog\/category\/web-hosting\/"},{"label":"Uses Of Sed Substitution In Unix Server","link":"https:\/\/www.bodhost.com\/blog\/uses-of-sed-substitution-in-unix-server\/"}],"_links":{"self":[{"href":"https:\/\/www.bodhost.com\/blog\/wp-json\/wp\/v2\/posts\/715","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bodhost.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bodhost.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bodhost.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bodhost.com\/blog\/wp-json\/wp\/v2\/comments?post=715"}],"version-history":[{"count":16,"href":"https:\/\/www.bodhost.com\/blog\/wp-json\/wp\/v2\/posts\/715\/revisions"}],"predecessor-version":[{"id":5596,"href":"https:\/\/www.bodhost.com\/blog\/wp-json\/wp\/v2\/posts\/715\/revisions\/5596"}],"wp:attachment":[{"href":"https:\/\/www.bodhost.com\/blog\/wp-json\/wp\/v2\/media?parent=715"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bodhost.com\/blog\/wp-json\/wp\/v2\/categories?post=715"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bodhost.com\/blog\/wp-json\/wp\/v2\/tags?post=715"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}