<?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: sed to replace a string after a match in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/sed-to-replace-a-string-after-a-match/m-p/515828#M144837</link>
    <description>&lt;P&gt;Awesome!!. Thank you so much!&lt;/P&gt;</description>
    <pubDate>Mon, 24 Aug 2020 15:59:31 GMT</pubDate>
    <dc:creator>anoopdi</dc:creator>
    <dc:date>2020-08-24T15:59:31Z</dc:date>
    <item>
      <title>sed to replace a string after a match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sed-to-replace-a-string-after-a-match/m-p/515806#M144828</link>
      <description>&lt;P&gt;Is there a way I can substitute a string after a regular expression match? For example, i want to replace the IP address which appears after 'Chrome/'&lt;/P&gt;&lt;P&gt;&lt;SPAN class="t"&gt;70.31.171.12&lt;/SPAN&gt; &lt;SPAN class="t"&gt;-&lt;/SPAN&gt; &lt;SPAN class="t"&gt;admin&lt;/SPAN&gt;&lt;SPAN&gt; [&lt;/SPAN&gt;&lt;SPAN class="t"&gt;24/Aug/2020:14:31:44.596&lt;/SPAN&gt;&lt;SPAN&gt; +&lt;/SPAN&gt;&lt;SPAN class="t"&gt;0000&lt;/SPAN&gt;&lt;SPAN&gt;] "&lt;/SPAN&gt;&lt;SPAN class="t"&gt;GET&lt;/SPAN&gt; &lt;SPAN class="t"&gt;/en-US/splunkd/__raw/services/search/shelper&lt;/SPAN&gt;&lt;SPAN&gt;?&lt;/SPAN&gt;&lt;SPAN class="t"&gt;output_mode=json&lt;/SPAN&gt;&lt;SPAN&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="t"&gt;snippet=true&lt;/SPAN&gt;&lt;SPAN&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="t"&gt;snippetEmbedJS=false&lt;/SPAN&gt;&lt;SPAN&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="t"&gt;namespace=search&lt;/SPAN&gt;&lt;SPAN&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="t"&gt;search=search&lt;/SPAN&gt;&lt;SPAN&gt;+&lt;/SPAN&gt;&lt;SPAN class="t"&gt;index&lt;/SPAN&gt;&lt;SPAN&gt;%3D&lt;/SPAN&gt;&lt;SPAN class="t"&gt;_internal&lt;/SPAN&gt;&lt;SPAN&gt;+&lt;/SPAN&gt;&lt;SPAN class="t"&gt;sourcetype&lt;/SPAN&gt;&lt;SPAN&gt;%3D&lt;/SPAN&gt;&lt;SPAN class="t"&gt;splunkd_ui_access&lt;/SPAN&gt;&lt;SPAN&gt;+&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="t"&gt;useTypeahead=true&lt;/SPAN&gt;&lt;SPAN&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="t"&gt;showCommandHelp=true&lt;/SPAN&gt;&lt;SPAN&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="t"&gt;showCommandHistory=true&lt;/SPAN&gt;&lt;SPAN&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="t"&gt;showFieldInfo=false&lt;/SPAN&gt;&lt;SPAN&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="t"&gt;_=1598275250371&lt;/SPAN&gt; &lt;SPAN class="t"&gt;HTTP/1.1&lt;/SPAN&gt;&lt;SPAN&gt;" &lt;/SPAN&gt;&lt;SPAN class="t"&gt;200&lt;/SPAN&gt; &lt;SPAN class="t"&gt;5620&lt;/SPAN&gt;&lt;SPAN&gt; "&lt;/SPAN&gt;&lt;SPAN class="t"&gt;-&lt;/SPAN&gt;&lt;SPAN&gt;" "&lt;/SPAN&gt;&lt;SPAN class="t"&gt;Mozilla/5.0&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN class="t"&gt;Windows&lt;/SPAN&gt; &lt;SPAN class="t"&gt;NT&lt;/SPAN&gt; &lt;SPAN class="t"&gt;10.0&lt;/SPAN&gt;&lt;SPAN&gt;; &lt;/SPAN&gt;&lt;SPAN class="t"&gt;Win64&lt;/SPAN&gt;&lt;SPAN&gt;; &lt;/SPAN&gt;&lt;SPAN class="t"&gt;x64&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN class="t"&gt;AppleWebKit/537.36&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN class="t"&gt;KHTML&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN class="t"&gt;like&lt;/SPAN&gt; &lt;SPAN class="t"&gt;Gecko&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN class="t"&gt;Chrome/84.0.4147.125&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN class="t"&gt;Safari/537.36&lt;/SPAN&gt;&lt;SPAN&gt;" &lt;/SPAN&gt;&lt;SPAN class="t"&gt;-&lt;/SPAN&gt; &lt;SPAN class="t"&gt;e02845bc5c07fae3e33855fca82cc968&lt;/SPAN&gt; &lt;SPAN class="t"&gt;12ms&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="t"&gt;I am able to use 'sed' to replace one more match of IP address but do not know how to replace a specific one.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="t"&gt;I want the event to look like this after the running sed,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="t"&gt;70.31.171.12 - admin&lt;SPAN&gt; [&lt;/SPAN&gt;24/Aug/2020:14:31:44.596&lt;SPAN&gt; +&lt;/SPAN&gt;0000&lt;SPAN&gt;] "&lt;/SPAN&gt;GET /en-US/splunkd/__raw/services/search/shelper&lt;SPAN&gt;?&lt;/SPAN&gt;output_mode=json&lt;SPAN&gt;&amp;amp;&lt;/SPAN&gt;snippet=true&lt;SPAN&gt;&amp;amp;&lt;/SPAN&gt;snippetEmbedJS=false&lt;SPAN&gt;&amp;amp;&lt;/SPAN&gt;namespace=search&lt;SPAN&gt;&amp;amp;&lt;/SPAN&gt;search=search&lt;SPAN&gt;+&lt;/SPAN&gt;index&lt;SPAN&gt;%3D&lt;/SPAN&gt;_internal&lt;SPAN&gt;+&lt;/SPAN&gt;sourcetype&lt;SPAN&gt;%3D&lt;/SPAN&gt;splunkd_ui_access&lt;SPAN&gt;+&amp;amp;&lt;/SPAN&gt;useTypeahead=true&lt;SPAN&gt;&amp;amp;&lt;/SPAN&gt;showCommandHelp=true&lt;SPAN&gt;&amp;amp;&lt;/SPAN&gt;showCommandHistory=true&lt;SPAN&gt;&amp;amp;&lt;/SPAN&gt;showFieldInfo=false&lt;SPAN&gt;&amp;amp;&lt;/SPAN&gt;_=1598275250371 HTTP/1.1&lt;SPAN&gt;" &lt;/SPAN&gt;200 5620&lt;SPAN&gt; "&lt;/SPAN&gt;-&lt;SPAN&gt;" "&lt;/SPAN&gt;Mozilla/5.0&lt;SPAN&gt; (&lt;/SPAN&gt;Windows NT 10.0&lt;SPAN&gt;; &lt;/SPAN&gt;Win64&lt;SPAN&gt;; &lt;/SPAN&gt;x64&lt;SPAN&gt;) &lt;/SPAN&gt;AppleWebKit/537.36&lt;SPAN&gt; (&lt;/SPAN&gt;KHTML&lt;SPAN&gt;, &lt;/SPAN&gt;like Gecko&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;STRONG&gt;Chrome/xxx.xxx.xxx.xxx&lt;/STRONG&gt;&amp;nbsp;Safari/537.36&lt;SPAN&gt;" &lt;/SPAN&gt;- e02845bc5c07fae3e33855fca82cc968 12ms&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Aug 2020 14:52:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sed-to-replace-a-string-after-a-match/m-p/515806#M144828</guid>
      <dc:creator>anoopdi</dc:creator>
      <dc:date>2020-08-24T14:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: sed to replace a string after a match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sed-to-replace-a-string-after-a-match/m-p/515822#M144835</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;| rex field=_raw mode=sed "s#Chrome/(\d+\.\d+\.\d+\.\d+)#Chrome/xxxxxxx#"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Works with previous sample.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;r. Ismo&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Aug 2020 15:47:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sed-to-replace-a-string-after-a-match/m-p/515822#M144835</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2020-08-24T15:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: sed to replace a string after a match</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sed-to-replace-a-string-after-a-match/m-p/515828#M144837</link>
      <description>&lt;P&gt;Awesome!!. Thank you so much!&lt;/P&gt;</description>
      <pubDate>Mon, 24 Aug 2020 15:59:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sed-to-replace-a-string-after-a-match/m-p/515828#M144837</guid>
      <dc:creator>anoopdi</dc:creator>
      <dc:date>2020-08-24T15:59:31Z</dc:date>
    </item>
  </channel>
</rss>

