<?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 How to replace/remove a specific character? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-remove-a-specific-character/m-p/387643#M113076</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have the below output :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"(|01/01/16|01/01/18|01/05/18|04/02/18|05/01/17|05/05/16|05/08/17|)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The desired output is to remove the first and last '|' : "(01/01/16|01/01/18|01/05/18|04/02/18|05/01/17|05/05/16|05/08/17)"&lt;/P&gt;

&lt;P&gt;My below code isn't working, can you please help me? &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Let's say search = "(|01/01/16|01/01/18|01/05/18|04/02/18|05/01/17|05/05/16|05/08/17|)"

| eval search = replace (search , "(|" , "(")
| eval search = replace (search , "|)" , ")")

Error : Error in 'eval' command: Regex: missing closing parenthesis
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 10 May 2018 08:19:43 GMT</pubDate>
    <dc:creator>RRajneesh</dc:creator>
    <dc:date>2018-05-10T08:19:43Z</dc:date>
    <item>
      <title>How to replace/remove a specific character?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-remove-a-specific-character/m-p/387643#M113076</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have the below output :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"(|01/01/16|01/01/18|01/05/18|04/02/18|05/01/17|05/05/16|05/08/17|)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The desired output is to remove the first and last '|' : "(01/01/16|01/01/18|01/05/18|04/02/18|05/01/17|05/05/16|05/08/17)"&lt;/P&gt;

&lt;P&gt;My below code isn't working, can you please help me? &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Let's say search = "(|01/01/16|01/01/18|01/05/18|04/02/18|05/01/17|05/05/16|05/08/17|)"

| eval search = replace (search , "(|" , "(")
| eval search = replace (search , "|)" , ")")

Error : Error in 'eval' command: Regex: missing closing parenthesis
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 May 2018 08:19:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-replace-remove-a-specific-character/m-p/387643#M113076</guid>
      <dc:creator>RRajneesh</dc:creator>
      <dc:date>2018-05-10T08:19:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace/remove a specific character?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-remove-a-specific-character/m-p/387644#M113077</link>
      <description>&lt;P&gt;You have to escape the characters in your regex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 1 
| eval test = "(|01/01/16|01/01/18|01/05/18|04/02/18|05/01/17|05/05/16|05/08/17|)"
| eval test1 = replace (test , "\(\|" , "(")
| eval test2 = replace (test1 , "\|\)" , ")")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope this helps&lt;/P&gt;</description>
      <pubDate>Thu, 10 May 2018 13:57:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-replace-remove-a-specific-character/m-p/387644#M113077</guid>
      <dc:creator>aholzer</dc:creator>
      <dc:date>2018-05-10T13:57:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace/remove a specific character?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-remove-a-specific-character/m-p/387645#M113078</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval test = "(|01/01/16|01/01/18|01/05/18|04/02/18|05/01/17|05/05/16|05/08/17|)" 
| rex field=test mode=sed "s/\(\|/(/ s/\|\)/)/"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 May 2018 14:22:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-replace-remove-a-specific-character/m-p/387645#M113078</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-05-10T14:22:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace/remove a specific character?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-remove-a-specific-character/m-p/387646#M113079</link>
      <description>&lt;P&gt;Thanks. - I tried it and it worked.&lt;/P&gt;</description>
      <pubDate>Thu, 10 May 2018 16:00:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-replace-remove-a-specific-character/m-p/387646#M113079</guid>
      <dc:creator>RRajneesh</dc:creator>
      <dc:date>2018-05-10T16:00:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace/remove a specific character?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-remove-a-specific-character/m-p/387647#M113080</link>
      <description>&lt;P&gt;If this is not a one-time thing, you could also make this replacement before ingesting the data by putting this sed in props.conf on the indexer, or even better on the forwarder:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[sourcetype]&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;SEDCMD-xyz s/\(\|/(/ s/\|\)/)/&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 May 2018 16:21:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-replace-remove-a-specific-character/m-p/387647#M113080</guid>
      <dc:creator>wrangler2x</dc:creator>
      <dc:date>2018-05-10T16:21:11Z</dc:date>
    </item>
  </channel>
</rss>

