{"componentChunkName":"component---src-templates-blog-post-js","path":"/unix-commands/","result":{"data":{"site":{"siteMetadata":{"title":"Recipes Collection","author":"Internet Community"}},"markdownRemark":{"id":"e6b6bf4e-c32b-5a34-8213-1652fc1ab0d7","html":"<h3 id=\"q---how-to-use-sed-to-find-and-replace-text-in-files-in-unix-shell\"><a href=\"#q---how-to-use-sed-to-find-and-replace-text-in-files-in-unix-shell\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Q - How to use sed to find and replace text in files in Unix shell?</h3>\n<ul>\n<li>\n<p>Use Stream EDitor (sed) as follows:</p>\n<ul>\n<li><code class=\"language-text\">sed -i &#39;s/old-text/new-text/g&#39; input.txt</code></li>\n</ul>\n</li>\n<li>The <code class=\"language-text\">s</code> is the substitute command of sed for find and replace. It tells sed to find all occurrences of ‘old-text’ and replace with ‘new-text’ in a file named input.txt</li>\n<li>\n<p>Verify that file has been updated:</p>\n<ul>\n<li><code class=\"language-text\">more input.txt</code></li>\n</ul>\n</li>\n</ul>\n<p>Reference</p>\n<ul>\n<li><a href=\"https://www.cyberciti.biz/faq/how-to-use-sed-to-find-and-replace-text-in-files-in-linux-unix-shell/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://www.cyberciti.biz/faq/how-to-use-sed-to-find-and-replace-text-in-files-in-linux-unix-shell/</a></li>\n</ul>\n<h3 id=\"q---how-to-stop-running-port-in-mac\"><a href=\"#q---how-to-stop-running-port-in-mac\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Q - How to stop running port in mac?</h3>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\"><span class=\"token function\">lsof</span> -i :6061\n<span class=\"token function\">kill</span> -QUIT <span class=\"token operator\">&lt;</span>PID<span class=\"token operator\">></span> // e.g. - <span class=\"token function\">kill</span> -QUIT <span class=\"token number\">31211</span></code></pre></div>","timeToRead":1,"frontmatter":{"title":"Unix Commands","date":null,"spoiler":null},"fields":{"slug":"/unix-commands/","langKey":"en"}}},"pageContext":{"slug":"/unix-commands/","previous":{"fields":{"slug":"/mac-os/keyboard-shortcuts/","langKey":"en","directoryName":"keyboard-shortcuts","maybeAbsoluteLinks":[]},"frontmatter":{"title":"Mac OS Keyboard Shortcuts"}},"next":{"fields":{"slug":"/miscellaneous/","langKey":"en","directoryName":"miscellaneous","maybeAbsoluteLinks":[]},"frontmatter":{"title":"Miscellaneous"}},"translations":[],"translatedLinks":[]}}}