{"id":48,"date":"2017-08-05T16:58:26","date_gmt":"2017-08-05T16:58:26","guid":{"rendered":"https:\/\/nixgeek.org\/?p=48"},"modified":"2017-08-05T16:58:26","modified_gmt":"2017-08-05T16:58:26","slug":"search-and-replace-in-vi","status":"publish","type":"post","link":"https:\/\/www.nixgeek.org\/index.php\/2017\/08\/05\/search-and-replace-in-vi\/","title":{"rendered":"Search and Replace in vi"},"content":{"rendered":"<p>Speaking of vi(m) tips, I&#8217;m quite fond of search and replace from within vi. The syntax is very similar to sed&#8217;s search and replace, and uses regex the same way. To do a simple replacement of all instances of &#8220;snoogins&#8221; with &#8220;snoochieboochies&#8221; you would want to type this while in command mode.<\/p>\n<blockquote>\n<pre>:%s\/snoogins\/snoochieboochies\/g<\/pre>\n<\/blockquote>\n<p>Like sed, the separateor does not have to be &#8220;\/&#8221;. Whatever character you type after the <b>s<\/b> becomes the separator. This can be handy when you want to replace slashes without having to escape them:<\/p>\n<blockquote>\n<pre>:%s~\/and\/some\/for\/a\/few~\/and\/one\/for\/all~g<\/pre>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Speaking of vi(m) tips, I&#8217;m quite fond of search and replace from within vi. The syntax is very similar to sed&#8217;s search and replace, and uses regex the same way. To do a simple replacement of all instances of &#8220;snoogins&#8221; with &#8220;snoochieboochies&#8221; you would want to type this while in command mode. :%s\/snoogins\/snoochieboochies\/g Like sed, [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[11,13,10,12],"class_list":["post-48","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-search-and-replace","tag-snoogins","tag-vi","tag-vim"],"_links":{"self":[{"href":"https:\/\/www.nixgeek.org\/index.php\/wp-json\/wp\/v2\/posts\/48","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nixgeek.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nixgeek.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nixgeek.org\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nixgeek.org\/index.php\/wp-json\/wp\/v2\/comments?post=48"}],"version-history":[{"count":1,"href":"https:\/\/www.nixgeek.org\/index.php\/wp-json\/wp\/v2\/posts\/48\/revisions"}],"predecessor-version":[{"id":49,"href":"https:\/\/www.nixgeek.org\/index.php\/wp-json\/wp\/v2\/posts\/48\/revisions\/49"}],"wp:attachment":[{"href":"https:\/\/www.nixgeek.org\/index.php\/wp-json\/wp\/v2\/media?parent=48"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nixgeek.org\/index.php\/wp-json\/wp\/v2\/categories?post=48"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nixgeek.org\/index.php\/wp-json\/wp\/v2\/tags?post=48"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}