<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Rex mode=sed diff between replace and substitute in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Rex-mode-sed-diff-between-replace-and-substitute/m-p/195172#M56280</link>
    <description>&lt;P&gt;If you're familiar with the traditional unix commands &lt;CODE&gt;sed&lt;/CODE&gt; and &lt;CODE&gt;tr&lt;/CODE&gt;, the difference is that one is &lt;CODE&gt;sed&lt;/CODE&gt;-like and the other is &lt;CODE&gt;tr&lt;/CODE&gt;-like.&lt;/P&gt;

&lt;P&gt;If you have an event of the form:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;06/10/2014 00:05:00 myapp does super-awesome-things for user=bobbychuck
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex mode=sed "s/awesome/terrible/"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;will cause it to say:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;06/10/2014 00:05:00 myapp does super-terrible-things for user=bobbychuck
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex mode=sed "y/abc/xyz/"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;will cause:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;06/10/2014 00:05:00 myxpp does super-xwesome-things for user=yoyyyzhuzk
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 10 Jun 2014 21:00:01 GMT</pubDate>
    <dc:creator>dwaddle</dc:creator>
    <dc:date>2014-06-10T21:00:01Z</dc:date>
    <item>
      <title>Rex mode=sed diff between replace and substitute</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-mode-sed-diff-between-replace-and-substitute/m-p/195171#M56279</link>
      <description>&lt;P&gt;What are the differences between option "s" and "y"?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal sourcetype=splunkd  | rex mode=sed “s/idx=\d+\.\d+\.\d+\.\d+\:\d+/XX.XXX.XX.XXX:XXXX/g"

index=_internal sourcetype=splunkd  | rex mode=sed "y/127.0.0.1:9997/XXX.X.X.X:XXXX/"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I can find all the logs with "Connected to blah blah" and replace the ip and port with something in both ways. Besides the fact that the substitute option will only grab the exact ip of "127.0.0.1", what are the major differences between these 2 options?&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/5.0.3/SearchReference/Rex"&gt;http://docs.splunk.com/Documentation/Splunk/5.0.3/SearchReference/Rex&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jun 2014 20:38:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-mode-sed-diff-between-replace-and-substitute/m-p/195171#M56279</guid>
      <dc:creator>ben_leung</dc:creator>
      <dc:date>2014-06-10T20:38:52Z</dc:date>
    </item>
    <item>
      <title>Re: Rex mode=sed diff between replace and substitute</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-mode-sed-diff-between-replace-and-substitute/m-p/195172#M56280</link>
      <description>&lt;P&gt;If you're familiar with the traditional unix commands &lt;CODE&gt;sed&lt;/CODE&gt; and &lt;CODE&gt;tr&lt;/CODE&gt;, the difference is that one is &lt;CODE&gt;sed&lt;/CODE&gt;-like and the other is &lt;CODE&gt;tr&lt;/CODE&gt;-like.&lt;/P&gt;

&lt;P&gt;If you have an event of the form:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;06/10/2014 00:05:00 myapp does super-awesome-things for user=bobbychuck
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex mode=sed "s/awesome/terrible/"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;will cause it to say:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;06/10/2014 00:05:00 myapp does super-terrible-things for user=bobbychuck
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex mode=sed "y/abc/xyz/"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;will cause:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;06/10/2014 00:05:00 myxpp does super-xwesome-things for user=yoyyyzhuzk
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Jun 2014 21:00:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-mode-sed-diff-between-replace-and-substitute/m-p/195172#M56280</guid>
      <dc:creator>dwaddle</dc:creator>
      <dc:date>2014-06-10T21:00:01Z</dc:date>
    </item>
    <item>
      <title>Re: Rex mode=sed diff between replace and substitute</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-mode-sed-diff-between-replace-and-substitute/m-p/195173#M56281</link>
      <description>&lt;P&gt;Thanks for responding dwaddle. I did not notice that the new characters match with the original ones.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jun 2014 21:08:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-mode-sed-diff-between-replace-and-substitute/m-p/195173#M56281</guid>
      <dc:creator>ben_leung</dc:creator>
      <dc:date>2014-06-10T21:08:11Z</dc:date>
    </item>
    <item>
      <title>Re: Rex mode=sed diff between replace and substitute</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-mode-sed-diff-between-replace-and-substitute/m-p/195174#M56282</link>
      <description>&lt;P&gt;Yeah, the idea of &lt;CODE&gt;s/xxx/yyy/&lt;/CODE&gt; is fundamentally search-and-replace string-for-string while &lt;CODE&gt;y/abc/xyz/&lt;/CODE&gt; is "replace every a with x, every b with y, and every c with z."  Both are useful but for different situations.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jun 2014 04:13:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-mode-sed-diff-between-replace-and-substitute/m-p/195174#M56282</guid>
      <dc:creator>dwaddle</dc:creator>
      <dc:date>2014-06-11T04:13:51Z</dc:date>
    </item>
    <item>
      <title>Re: Rex mode=sed diff between replace and substitute</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-mode-sed-diff-between-replace-and-substitute/m-p/195175#M56283</link>
      <description>&lt;P&gt;Thanks Dwaddle!&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2020 17:31:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-mode-sed-diff-between-replace-and-substitute/m-p/195175#M56283</guid>
      <dc:creator>vijaysubramania</dc:creator>
      <dc:date>2020-05-20T17:31:57Z</dc:date>
    </item>
  </channel>
</rss>

