<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>search on
A Scripter's Notes</title><link>https://scripter.co/categories/search/</link><description>Recent content in search
on A Scripter's Notes</description><language>en-us</language><managingEditor>kaushal.modi@gmail.com (Kaushal Modi)</managingEditor><webMaster>kaushal.modi@gmail.com (Kaushal Modi)</webMaster><lastBuildDate>Wed, 22 Apr 2026 08:24:58 -0400</lastBuildDate><generator>Hugo -- gohugo.io</generator><docs>https://validator.w3.org/feed/docs/rss2.html</docs><atom:link href="https://scripter.co/categories/search/index.xml" rel="self" type="application/rss+xml"/><item><title>Search/replace groups using sed</title><link>https://scripter.co/search-replace-groups-using-sed/</link><description>&lt;p>This is the most common way of my sed usage:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">&lt;span class="nb">echo&lt;/span> Good morning &lt;span class="p">|&lt;/span> sed &lt;span class="s1">&amp;#39;s/\(.*\s\+\).*/\1evening/g&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Here are brief notes on that ..&lt;/p>
&lt;p>The above script changes &lt;code>Good morning&lt;/code> to &lt;code>Good evening&lt;/code>.
Note that the following characters needed the escape character &lt;code>\&lt;/code>:&lt;/p>
&lt;ul>
&lt;li>Brackets to create regex groups: &lt;code>\(&lt;/code> &lt;code>\)&lt;/code>&lt;/li>
&lt;li>Plus sign to match one or more times: &lt;code>\+&lt;/code>&lt;/li>
&lt;li>Note that the &lt;code>.&lt;/code> and &lt;code>*&lt;/code> characters don&amp;rsquo;t need escaping.&lt;/li>
&lt;/ul></description><category domain="https://scripter.co/categories/sed">sed</category><category domain="https://scripter.co/categories/regex">regex</category><category domain="https://scripter.co/categories/escape">escape</category><category domain="https://scripter.co/categories/search">search</category><category domain="https://scripter.co/categories/replace">replace</category><guid>https://scripter.co/search-replace-groups-using-sed/</guid><pubDate>Wed, 16 Apr 2014 14:16:42 -0400</pubDate></item></channel></rss>